Skip to content

Commit

Permalink
Merge pull request #8526 from chrahunt/reduce-dependence-on-files
Browse files Browse the repository at this point in the history
Reduce dependence on disk files during Wheel installation
  • Loading branch information
chrahunt authored Jul 3, 2020
2 parents e3ba8d9 + abed1d6 commit ea7ee7d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/pip/_internal/operations/install/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,6 @@ def install_unpacked_wheel(
else:
lib_dir = scheme.platlib

subdirs = os.listdir(source)
data_dirs = [s for s in subdirs if s.endswith('.data')]

# Record details of the files moved
# installed = files copied from the wheel to the destination
# changed = files changed while installing (scripts #! line typically)
Expand Down Expand Up @@ -473,6 +470,10 @@ def is_entrypoint_wrapper(name):
# Ignore setuptools-generated scripts
return (matchname in console or matchname in gui)

# Zip file path separators must be /
subdirs = set(p.split("/", 1)[0] for p in wheel_zip.namelist())
data_dirs = [s for s in subdirs if s.endswith('.data')]

for datadir in data_dirs:
fixer = None
filter = None
Expand All @@ -481,10 +482,12 @@ def is_entrypoint_wrapper(name):
if subdir == 'scripts':
fixer = fix_script
filter = is_entrypoint_wrapper
source = os.path.join(wheeldir, datadir, subdir)
full_datadir_path = os.path.join(wheeldir, datadir, subdir)
dest = getattr(scheme, subdir)
clobber(
ensure_text(source, encoding=sys.getfilesystemencoding()),
ensure_text(
full_datadir_path, encoding=sys.getfilesystemencoding()
),
ensure_text(dest, encoding=sys.getfilesystemencoding()),
False,
fixer=fixer,
Expand Down

0 comments on commit ea7ee7d

Please sign in to comment.