Set `data_dirs` closer to first use
Reducing the scope of variables reduces possible dependencies between
parts of this function, and will make it easier to extract this section
into its own function.
@@ -366,10 +366,6 @@ def install_unpacked_wheel(
else:
lib_dir = scheme.platlib
- # 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')]
-
# Record details of the files moved
# installed = files copied from the wheel to the destination
# changed = files changed while installing (scripts #! line typically)
@@ -486,6 +482,10 @@ def install_unpacked_wheel(
# 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
