aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command/egg_info.py
diff options
context:
space:
mode:
authorW. Trevor King <wking@tremily.us>2014-10-16 21:49:22 -0700
committerW. Trevor King <wking@tremily.us>2014-10-16 21:49:22 -0700
commit03048c86ba6f955179cb4dcab5dd2db024609f19 (patch)
tree685caf8e10fec62d0546c46cd8300b22b6f74bd4 /setuptools/command/egg_info.py
parent76906b7a50726de89307d55690338d0f40a5aadb (diff)
downloadexternal_python_setuptools-03048c86ba6f955179cb4dcab5dd2db024609f19.tar.gz
external_python_setuptools-03048c86ba6f955179cb4dcab5dd2db024609f19.tar.bz2
external_python_setuptools-03048c86ba6f955179cb4dcab5dd2db024609f19.zip
egg_info: Split manifest_maker._add_egg_info into its own method
On Sat, Oct 11, 2014 at 04:23:37PM -0000, Jason R. Coombs wrote [1]: > I suggest implementing the functionality as a separate method with a > docstring explaining the purpose. so that's what we have here. The docstring is adapted from the cbd4f603 (egg_info: Search egg-base for files to add to the manifest, 2014-10-16) commit message. It's a lot of docs for a single command (although there is a newsted list comprehension), so I'm fine if you drop this commit before merging. The motivation behind the lines would still be available in the version control history: $ hg blame -c setuptools/command/egg_info.py | grep -A1 ei_cmd.egg_base cbd4f6038604: if ei_cmd.egg_base != os.curdir: cbd4f6038604: self.filelist.allfiles.extend([ cbd4f6038604: os.path.join(ei_cmd.egg_base, path) cbd4f6038604: for path in distutils.filelist.findall(ei_cmd.egg_base)]) 80108b046cb6: self.filelist.include_pattern("*", prefix=ei_cmd.egg_info) $ hg log -vr cbd4f6038604 changeset: 3163:cbd4f6038604 ... description: egg_info: Search egg-base for files to add to the manifest Before this commit, this: $ mkdir -p /tmp/xyz/{home,lib,scripts,data,egg} $ cat >/tmp/xyz/home/.pydistutils.cfg <<EOF ... [1]: https://bitbucket.org/pypa/setuptools/pull-request/85/egg_info-search-egg-base-for-files-to-add/diff#comment-3418032
Diffstat (limited to 'setuptools/command/egg_info.py')
-rwxr-xr-xsetuptools/command/egg_info.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 2318e54d..302d6874 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -326,11 +326,28 @@ class manifest_maker(sdist):
self.read_manifest()
ei_cmd = self.get_finalized_command('egg_info')
if ei_cmd.egg_base != os.curdir:
- self.filelist.allfiles.extend([
- os.path.join(ei_cmd.egg_base, path)
- for path in distutils.filelist.findall(ei_cmd.egg_base)])
+ self._add_egg_info(cmd=ei_cmd)
self.filelist.include_pattern("*", prefix=ei_cmd.egg_info)
+ def _add_egg_info(self, cmd):
+ """Add paths for egg-info files for an external egg-base.
+
+ The egg-info files are written to egg-base. If egg-base is
+ outside the current working directory, we need a separate step
+ (this method) to search the egg-base directory when creating
+ the manifest. We use distutils.filelist.findall (which is
+ really the version monkeypatched in by setuptools/__init__.py)
+ to perform the search.
+
+ Since findall records relative paths, prefix the returned
+ paths with cmd.egg_base, so add_default's include_pattern call
+ (which is looking for the absolute cmd.egg_info) will match
+ them.
+ """
+ self.filelist.allfiles.extend([
+ os.path.join(cmd.egg_base, path)
+ for path in distutils.filelist.findall(cmd.egg_base)])
+
def prune_file_list(self):
build = self.get_finalized_command('build')
base_dir = self.distribution.get_fullname()