Skip to content

Commit

Permalink
Merge pull request #920 from nerdvegas/issue_919-disable-pkg-cache-build
Browse files Browse the repository at this point in the history
default to disable package caching during build
  • Loading branch information
nerdvegas authored Aug 4, 2020
2 parents 60faa18 + 78361f8 commit 72051cc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/rez/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 12 additions & 4 deletions src/rez/resolved_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/rez/rezconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 72051cc

Please sign in to comment.