mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Only check for .dist-info directories at the top-level
Previously we were restricting to a single .dist-info directory anywhere in the unpacked wheel directory. That was incorrect since only a top-level .dist-info directory indicates a contained "package". Now we limit our restriction to top-level .dist-info directories.
This commit is contained in:
parent
7420629800
commit
93900e1199
3 changed files with 19 additions and 1 deletions
|
@ -383,6 +383,7 @@ def install_unpacked_wheel(
|
|||
continue
|
||||
elif (
|
||||
is_base and
|
||||
basedir == '' and
|
||||
s.endswith('.dist-info')
|
||||
):
|
||||
assert not info_dir, (
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue