From 78361f83e5ad9fe44707d171a43a0adcc890b99c Mon Sep 17 00:00:00 2001 From: ajohns Date: Tue, 4 Aug 2020 12:11:59 +1000 Subject: [PATCH] default to disable package caching during build --- src/rez/config.py | 1 + src/rez/resolved_context.py | 16 ++++++++++++---- src/rez/rezconfig.py | 3 +++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/rez/config.py b/src/rez/config.py index bc2bf80b9..d2e85d510 100644 --- a/src/rez/config.py +++ b/src/rez/config.py @@ -406,6 +406,7 @@ def _parse_env_var(self, value): "package_cache_clean_limit": Float, "allow_unversioned_packages": Bool, "rxt_as_yaml": Bool, + "package_cache_during_build": Bool, "package_cache_local": Bool, "package_cache_same_device": Bool, "color_enabled": ForceOrBool, diff --git a/src/rez/resolved_context.py b/src/rez/resolved_context.py index 793a83bfc..78bae34c0 100644 --- a/src/rez/resolved_context.py +++ b/src/rez/resolved_context.py @@ -153,7 +153,7 @@ def __init__(self, package_requests, verbosity=0, timestamp=None, package_filter=None, package_orderers=None, max_fails=-1, add_implicit_packages=True, time_limit=-1, callback=None, package_load_callback=None, buf=None, suppress_passive=False, - print_stats=False, package_caching=True): + print_stats=False, package_caching=None): """Perform a package resolve, and store the result. Args: @@ -188,9 +188,10 @@ def __init__(self, package_requests, verbosity=0, timestamp=None, suppress_passive (bool): If True, don't print debugging info that has had no effect on the solve. This argument only has an effect if `verbosity` > 2. - print_stats (bool): If true, print advanced solver stats at the end. - package_caching (bool): If True, apply package caching settings as - per the config. + print_stats (bool): If True, print advanced solver stats at the end. + package_caching (bool|None): If True, apply package caching settings + as per the config. If None, enable as determined by config + setting 'package_cache_during_build'. """ self.load_path = None @@ -226,6 +227,13 @@ def __init__(self, package_requests, verbosity=0, timestamp=None, # settings that affect context execution self.append_sys_path = True + + if package_caching is None: + if building: + package_caching = config.package_cache_during_build + else: + package_caching = True + self.package_caching = package_caching # patch settings diff --git a/src/rez/rezconfig.py b/src/rez/rezconfig.py index 9931a44eb..e26be2081 100644 --- a/src/rez/rezconfig.py +++ b/src/rez/rezconfig.py @@ -258,6 +258,9 @@ # To disable, set to zero. package_cache_max_variant_days = 30 +# Enable package caching during a package build. +package_cache_during_build = False + # Allow caching of local packages. You would only want to set this True for # testing purposes. package_cache_local = False