summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command/sdist.py
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-06-08 01:06:02 (GMT)
committerGreg Ward <gward@python.net>2000-06-08 01:06:02 (GMT)
commitce15c6ce8dac7a7aa25eed6033ce1b459b312aab (patch)
treef81c394d74bf2dfab56c38888fb1ad561992b8a4 /Lib/distutils/command/sdist.py
parent4a7319ca286e78ae9ddf9f86a50eee3eab813855 (diff)
downloadcpython-ce15c6ce8dac7a7aa25eed6033ce1b459b312aab.zip
cpython-ce15c6ce8dac7a7aa25eed6033ce1b459b312aab.tar.gz
cpython-ce15c6ce8dac7a7aa25eed6033ce1b459b312aab.tar.bz2
Moved the code that prunes the file list after reading the manifest
template into a new method 'prune_file_list()', called from 'get_file_list()' rather than 'read_manifest()' -- this keeps 'read_manifest()' more general. Deleted the redundant call to 'exclude_pattern()' in 'make_distribution()' -- this had the same intention as 'prune_file_list()', but was incomplete (only pruned the release tree, not the build tree) and in the wrong place (the prune wouldn't be reflected in the manifest file).
Diffstat (limited to 'Lib/distutils/command/sdist.py')
-rw-r--r--Lib/distutils/command/sdist.py23
1 files changed, 14 insertions, 9 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py
index 2624135..5a78cc5 100644
--- a/Lib/distutils/command/sdist.py
+++ b/Lib/distutils/command/sdist.py
@@ -195,6 +195,9 @@ class sdist (Command):
if template_exists:
self.read_template ()
+ # Prune away the build and source distribution directories
+ self.prune_file_list()
+
# File list now complete -- sort it so that higher-level files
# come first
sortable_files = map (os.path.split, self.files)
@@ -475,15 +478,21 @@ class sdist (Command):
# while loop over lines of template file
- # Prune away the build and source distribution directories
- build = self.get_finalized_command ('build')
- self.exclude_pattern (self.files, None, prefix=build.build_base)
+ # read_template ()
+
+ def prune_file_list (self):
+ """Prune off branches that might slip into the file list as created
+ by 'read_template()', but really don't belong there: specifically,
+ the build tree (typically "build") and the release tree itself
+ (only an issue if we ran "sdist" previously with --keep-tree, or it
+ aborted).
+ """
+ build = self.get_finalized_command('build')
base_dir = self.distribution.get_fullname()
+ self.exclude_pattern (self.files, None, prefix=build.build_base)
self.exclude_pattern (self.files, None, prefix=base_dir)
- # read_template ()
-
def select_pattern (self, files, pattern, anchor=1, prefix=None):
"""Select strings (presumably filenames) from 'files' that match
@@ -612,10 +621,6 @@ class sdist (Command):
# done elsewhere.
base_dir = self.distribution.get_fullname()
- # Remove any files that match "base_dir" from the fileset -- we
- # don't want to go distributing the distribution inside itself!
- self.exclude_pattern (self.files, base_dir + "*")
-
self.make_release_tree (base_dir, self.files)
archive_files = [] # remember names of files we create
for fmt in self.formats: