1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge pull request #7519 from chrahunt/bugfix/restrict-two-dist-info-dirs-toplevel-only

Only check for .dist-info directories at the top-level
This commit is contained in:
Christopher Hunt 2019-12-29 20:16:25 +08:00 committed by GitHub
commit dc860e865e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 1 deletions

View file

@ -383,6 +383,7 @@ def install_unpacked_wheel(
continue
elif (
is_base and
basedir == '' and
s.endswith('.dist-info')
):
assert not info_dir, (

View file

@ -472,3 +472,20 @@ def test_wheel_install_fails_with_unrelated_dist_info(script):
"'simple-0.1.0.dist-info' does not start with 'unrelated'"
in result.stderr
)
def test_wheel_installs_ok_with_nested_dist_info(script):
package = create_basic_wheel_for_package(
script,
"simple",
"0.1.0",
extra_files={
"subdir/unrelated-2.0.0.dist-info/WHEEL": "Wheel-Version: 1.0",
"subdir/unrelated-2.0.0.dist-info/METADATA": (
"Name: unrelated\nVersion: 2.0.0\n"
),
},
)
script.pip(
"install", "--no-cache-dir", "--no-index", package
)

View file

@ -997,7 +997,7 @@ def create_basic_wheel_for_package(
for fname in files:
path = script.temp_path / fname
path.parent.mkdir(exist_ok=True)
path.parent.mkdir(exist_ok=True, parents=True)
path.write_text(files[fname])
retval = script.scratch_path / archive_name