Skip to content

Commit

Permalink
Mostly performance minded but does fix a bug upgrading packages with …
Browse files Browse the repository at this point in the history
…markers on CLI
  • Loading branch information
matteius committed Nov 6, 2024
1 parent 9a81fc0 commit 7a1b80c
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions pipenv/utils/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7a1b80c

Please sign in to comment.