Skip to content

Commit dc860e8

Browse files
authored
Merge pull request #7519 from chrahunt/bugfix/restrict-two-dist-info-dirs-toplevel-only
Only check for .dist-info directories at the top-level
2 parents b3741ac + 93900e1 commit dc860e8

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

src/pip/_internal/operations/install/wheel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ def clobber(
383383
continue
384384
elif (
385385
is_base and
386+
basedir == '' and
386387
s.endswith('.dist-info')
387388
):
388389
assert not info_dir, (

tests/functional/test_install_wheel.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,20 @@ def test_wheel_install_fails_with_unrelated_dist_info(script):
472472
"'simple-0.1.0.dist-info' does not start with 'unrelated'"
473473
in result.stderr
474474
)
475+
476+
477+
def test_wheel_installs_ok_with_nested_dist_info(script):
478+
package = create_basic_wheel_for_package(
479+
script,
480+
"simple",
481+
"0.1.0",
482+
extra_files={
483+
"subdir/unrelated-2.0.0.dist-info/WHEEL": "Wheel-Version: 1.0",
484+
"subdir/unrelated-2.0.0.dist-info/METADATA": (
485+
"Name: unrelated\nVersion: 2.0.0\n"
486+
),
487+
},
488+
)
489+
script.pip(
490+
"install", "--no-cache-dir", "--no-index", package
491+
)

tests/lib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ def hello():
997997

998998
for fname in files:
999999
path = script.temp_path / fname
1000-
path.parent.mkdir(exist_ok=True)
1000+
path.parent.mkdir(exist_ok=True, parents=True)
10011001
path.write_text(files[fname])
10021002

10031003
retval = script.scratch_path / archive_name

0 commit comments

Comments
 (0)