Skip to content

Commit 4bfc54d

Browse files
authored
Merge pull request #8552 from chrahunt/do-not-extract-wheel-in-prepare
Do not extract wheels in requirement preparation
2 parents 334f06e + c9f87a6 commit 4bfc54d

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

src/pip/_internal/operations/prepare.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,9 @@ def unpack_url(
260260
)
261261

262262
# unpack the archive to the build dir location. even when only downloading
263-
# archives, they have to be unpacked to parse dependencies
264-
unpack_file(file.path, location, file.content_type)
263+
# archives, they have to be unpacked to parse dependencies, except wheels
264+
if not link.is_wheel:
265+
unpack_file(file.path, location, file.content_type)
265266

266267
return file
267268

@@ -390,20 +391,14 @@ def _ensure_link_req_src_dir(self, req, download_dir, parallel_builds):
390391
"""Ensure source_dir of a linked InstallRequirement."""
391392
# Since source_dir is only set for editable requirements.
392393
if req.link.is_wheel:
393-
if download_dir:
394-
# When downloading, we only unpack wheels to get
395-
# metadata.
396-
autodelete_unpacked = True
397-
else:
398-
# When installing a wheel, we use the unpacked wheel.
399-
autodelete_unpacked = False
400-
else:
401-
# We always delete unpacked sdists after pip runs.
402-
autodelete_unpacked = True
394+
# We don't need to unpack wheels, so no need for a source
395+
# directory.
396+
return
403397
assert req.source_dir is None
398+
# We always delete unpacked sdists after pip runs.
404399
req.ensure_has_source_dir(
405400
self.build_dir,
406-
autodelete=autodelete_unpacked,
401+
autodelete=True,
407402
parallel_builds=parallel_builds,
408403
)
409404

0 commit comments

Comments
 (0)