Skip to content

Commit

Permalink
Merge branch 'issue_1089-rez-rm-memcache-bug'
Browse files Browse the repository at this point in the history
  • Loading branch information
ajohns committed Jun 2, 2021
2 parents 37a31ea + d433aea commit 02157ee
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/rez/utils/_version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@


# Update this value to version up Rez. Do not place anything else in this file.
_rez_version = "2.89.0"
_rez_version = "2.89.1"


# Copyright 2013-2016 Allan Johns.
Expand Down
41 changes: 27 additions & 14 deletions src/rezplugins/package_repository/filesystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,14 @@ class FileSystemPackageRepository(PackageRepository):
def name(cls):
return "filesystem"

def __init__(self, location, resource_pool):
def __init__(self, location, resource_pool, disable_memcache=None,
disable_pkg_ignore=False):
"""Create a filesystem package repository.
Args:
location (str): Path containing the package repository.
disable_memcache (bool): Don't use memcache memcache if True
disable_pkg_ignore (bool): If True, .ignore* files have no effect
"""

# ensure that differing case doesn't get interpreted as different repos
Expand All @@ -500,7 +503,12 @@ def __init__(self, location, resource_pool):
if os.path.exists(settings_filepath):
local_settings.update(load_yaml(settings_filepath))

self.disable_memcache = local_settings.get("disable_memcache", False)
self.disable_pkg_ignore = disable_pkg_ignore

if disable_memcache is None:
self.disable_memcache = local_settings.get("disable_memcache", False)
else:
self.disable_memcache = disable_memcache

# TODO allow these settings to be overridden in settings.yaml also
global _settings
Expand Down Expand Up @@ -538,8 +546,6 @@ def __init__(self, location, resource_pool):
)
self._get_version_dirs = decorator2(self._get_version_dirs)

self._disable_pkg_ignore = False

def _uid(self):
t = ["filesystem", self.location]
if os.path.exists(self.location):
Expand Down Expand Up @@ -650,7 +656,11 @@ def get_variant_from_uri(self, uri):
def ignore_package(self, pkg_name, pkg_version, allow_missing=False):
# find package, even if already ignored
if not allow_missing:
repo_copy = self._copy(disable_pkg_ignore=True)
repo_copy = self._copy(
disable_pkg_ignore=True,
disable_memcache=True
)

if not repo_copy.get_package(pkg_name, pkg_version):
return -1

Expand Down Expand Up @@ -700,7 +710,10 @@ def remove_package(self, pkg_name, pkg_version):
return False

# check for combined-style package, this is not supported
repo_copy = self._copy(disable_pkg_ignore=True)
repo_copy = self._copy(
disable_pkg_ignore=True,
disable_memcache=True
)

pkg = repo_copy.get_package(pkg_name, pkg_version)
assert pkg
Expand Down Expand Up @@ -908,16 +921,12 @@ def _create_variant():

return variant

def _copy(self, disable_pkg_ignore=False):
def _copy(self, **kwargs):
"""
Make a copy of the repo that does not share resources with this one.
"""
pool = ResourcePool(cache_size=None)
repo_copy = self.__class__(self.location, pool)

if disable_pkg_ignore:
repo_copy._disable_pkg_ignore = True

repo_copy = self.__class__(self.location, pool, **kwargs)
return repo_copy

@contextmanager
Expand Down Expand Up @@ -1018,7 +1027,7 @@ def _get_version_dirs__key(self, root):
def _get_version_dirs(self, root):
# Ignore a version if there is a .ignore<version> file next to it
def ignore_dir(name):
if self._disable_pkg_ignore:
if self.disable_pkg_ignore:
return False
else:
path = os.path.join(root, self.ignore_prefix + name)
Expand Down Expand Up @@ -1420,7 +1429,11 @@ def _remove_build_keys(obj):
#
new_variant = None

repo_copy = self._copy(disable_pkg_ignore=True)
repo_copy = self._copy(
disable_pkg_ignore=True,
disable_memcache=True
)

pkg = repo_copy.get_package(variant_name, variant_version)

if pkg is not None:
Expand Down

0 comments on commit 02157ee

Please sign in to comment.