summaryrefslogtreecommitdiff
path: root/setuptools/command/build_py.py
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2022-06-18 09:39:27 +0100
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2022-06-18 09:39:27 +0100
commit84d5133b63dd6c2f64cc38ced7ec8f93f1725cac (patch)
tree11f6cf3d082a00b4b56047454e8cfb2076a2f1cc /setuptools/command/build_py.py
parentecdeb225804010e2f68c7ec5d72e39364873324d (diff)
downloadpython-setuptools-git-84d5133b63dd6c2f64cc38ced7ec8f93f1725cac.tar.gz
build_py: Allow get_outputs() to work without re-running egg-info
Diffstat (limited to 'setuptools/command/build_py.py')
-rw-r--r--setuptools/command/build_py.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/setuptools/command/build_py.py b/setuptools/command/build_py.py
index 9575cdf8..dab81327 100644
--- a/setuptools/command/build_py.py
+++ b/setuptools/command/build_py.py
@@ -29,6 +29,8 @@ class build_py(orig.build_py):
'py_modules' and 'packages' in the same setup operation.
"""
+ existing_egg_info_dir = None #: Private API, setuptools internal use only.
+
def finalize_options(self):
orig.build_py.finalize_options(self)
self.package_data = self.distribution.package_data
@@ -143,10 +145,19 @@ class build_py(orig.build_py):
# Locate package source directory
src_dirs[assert_relative(self.get_package_dir(package))] = package
- self.run_command('egg_info')
+ if (
+ getattr(self, 'existing_egg_info_dir', None)
+ and Path(self.existing_egg_info_dir, "SOURCES.txt").exists()
+ ):
+ manifest = Path(self.existing_egg_info_dir, "SOURCES.txt")
+ files = manifest.read_text(encoding="utf-8").splitlines()
+ else:
+ self.run_command('egg_info')
+ ei_cmd = self.get_finalized_command('egg_info')
+ files = ei_cmd.filelist.files
+
check = _IncludePackageDataAbuse()
- ei_cmd = self.get_finalized_command('egg_info')
- for path in ei_cmd.filelist.files:
+ for path in files:
d, f = os.path.split(assert_relative(path))
prev = None
oldf = f