From 7a1b80cce76be52f0470e18cd239b862515ec84f Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Wed, 6 Nov 2024 13:18:19 -0500 Subject: [PATCH] Mostly performance minded but does fix a bug upgrading packages with markers on CLI --- pipenv/utils/resolver.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/pipenv/utils/resolver.py b/pipenv/utils/resolver.py index 8ad9d2238..1e455ba08 100644 --- a/pipenv/utils/resolver.py +++ b/pipenv/utils/resolver.py @@ -14,6 +14,9 @@ from pipenv.patched.pip._internal.commands.install import InstallCommand from pipenv.patched.pip._internal.exceptions import InstallationError from pipenv.patched.pip._internal.models.target_python import TargetPython +from pipenv.patched.pip._internal.operations.build.build_tracker import ( + get_build_tracker, +) from pipenv.patched.pip._internal.req.constructors import ( install_req_from_parsed_requirement, ) @@ -76,18 +79,6 @@ def get_package_finder( ) -class BuildTracker: - def __init__(self, root): - self.root = root - if not root: - os.environ["PIP_BUILD_TRACKER"] = self.root - - def cleanup(self): - if self.root and "PIP_BUILD_TRACKER" in os.environ: - del os.environ["PIP_BUILD_TRACKER"] - # Add any necessary cleanup logic here - - class HashCacheMixin: """Caches hashes of PyPI artifacts so we do not need to re-download them. @@ -431,8 +422,9 @@ def constraints(self): def resolve(self): from pipenv.patched.pip._internal.utils.temp_dir import TempDirectory - with global_tempdir_manager(), TempDirectory(globally_managed=True) as temp_dir: - build_tracker = BuildTracker(temp_dir) + with global_tempdir_manager(), get_build_tracker() as build_tracker, TempDirectory( + globally_managed=True + ) as temp_dir: try: finder = self.finder() wheel_cache = WheelCache(self.pip_options.cache_dir)