summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2014-05-16 09:05:37 -0400
committerJason R. Coombs <jaraco@jaraco.com>2014-05-16 09:05:37 -0400
commit98252c9624c564444307544bf77c7aa3828aa024 (patch)
treebb92ef67596b0cd5da481293f956f69329da100c /setuptools
parentafa18c94fe1ae79db2542af2cc056e31998400d6 (diff)
downloadpython-setuptools-git-98252c9624c564444307544bf77c7aa3828aa024.tar.gz
Add a _repair method to repair the FileList after unsafe entries have been added.
Diffstat (limited to 'setuptools')
-rwxr-xr-xsetuptools/command/egg_info.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index a2f4d444..2097f2a9 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -215,6 +215,16 @@ class FileList(_FileList):
def extend(self, paths):
self.files.extend(filter(self._safe_path, paths))
+ def _repair(self):
+ """
+ Replace self.files with only safe paths
+
+ Because some owners of FileList manipulate the underlying
+ ``files`` attribute directly, this method must be called to
+ repair those paths.
+ """
+ self.files = list(filter(self._safe_path, self.files))
+
def _safe_path(self, path):
if not PY3:
return os.path.exists(path)
@@ -257,6 +267,8 @@ class manifest_maker(sdist):
Write the file list in 'self.filelist' to the manifest file
named by 'self.manifest'.
"""
+ self.filelist._repair()
+
files = [f.replace(os.sep, '/') for f in self.filelist.files]
msg = "writing manifest file '%s'" % self.manifest
self.execute(write_file, (self.manifest, files), msg)