def _get_lock_requirement(self, lock_type): if lock_type == PatchLock.no_lock: return None version = self.reference_variant.version if self.reference_variant \ else self.variant.version return get_lock_request(self.variant.name, version, lock_type, weak=False)
def get_lock_requests(self): """Take the current context, and the current patch locks, and determine the effective requests that will be added to the main request. Returns: A dict of (PatchLock, [Requirement]) tuples. Each requirement will be a weak package reference. If there is no current context, an empty dict will be returned. """ d = defaultdict(list) if self._context: for variant in self._context.resolved_packages: name = variant.name version = variant.version lock = self.patch_locks.get(name) if lock is None: lock = self.default_patch_lock request = get_lock_request(name, version, lock) if request is not None: d[lock].append(request) return d