Skip to content

Commit 4ca684f

Browse files
committed
Fix for source directory reuse
1 parent 549a9d1 commit 4ca684f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/pip/_internal/req/req_install.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import os
88
import shutil
99
import sys
10+
import uuid
1011
import zipfile
1112

1213
from pip._vendor import pkg_resources, six
@@ -354,16 +355,16 @@ def ensure_build_location(self, build_dir, autodelete):
354355
)
355356

356357
return self._temp_build_dir.path
357-
if self.editable:
358-
name = self.name.lower()
359-
else:
360-
name = self.name
358+
dir_name = "{}_{}".format(
359+
canonicalize_name(self.name),
360+
uuid.uuid4().hex,
361+
)
361362
# FIXME: Is there a better place to create the build_dir? (hg and bzr
362363
# need this)
363364
if not os.path.exists(build_dir):
364365
logger.debug('Creating directory %s', build_dir)
365366
os.makedirs(build_dir)
366-
actual_build_dir = os.path.join(build_dir, name)
367+
actual_build_dir = os.path.join(build_dir, dir_name)
367368
# `None` indicates that we respect the globally-configured deletion
368369
# settings, which is what we actually want when auto-deleting.
369370
delete_arg = None if autodelete else False

tests/functional/test_new_resolver.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,6 @@ def test_new_resolver_extra_merge_in_package(
863863
assert_installed(script, pkg="1.0.0", dep="1.0.0", depdev="1.0.0")
864864

865865

866-
@pytest.mark.xfail(reason="pre-existing build directory")
867866
def test_new_resolver_build_directory_error_zazo_19(script):
868867
"""https://github.com/pradyunsg/zazo/issues/19#issuecomment-631615674
869868

0 commit comments

Comments
 (0)