diff options
author | Greg Ward <gward@python.net> | 2000-09-06 02:18:59 (GMT) |
---|---|---|
committer | Greg Ward <gward@python.net> | 2000-09-06 02:18:59 (GMT) |
commit | 5fad268ffc761e6b4b470733e15dc0209d9fb172 (patch) | |
tree | 884aff38823e38b1b5e7e62b6fcf7c2343be137a /Lib | |
parent | d3b76a8fbfc2af2d01ce48c323c9f76c0947af49 (diff) | |
download | cpython-5fad268ffc761e6b4b470733e15dc0209d9fb172.zip cpython-5fad268ffc761e6b4b470733e15dc0209d9fb172.tar.gz cpython-5fad268ffc761e6b4b470733e15dc0209d9fb172.tar.bz2 |
Bullet-proofing of 'make_release_tree()':
- 'mkpath()' the distribution dir in case of empty manifest
- warn if empty manifest
- detect, warn about, and skip non-regular files in manifest
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/distutils/command/sdist.py | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py index 1bf297f..6de703e 100644 --- a/Lib/distutils/command/sdist.py +++ b/Lib/distutils/command/sdist.py @@ -405,9 +405,11 @@ class sdist (Command): to be distributed. """ # Create all the directories under 'base_dir' necessary to - # put 'files' there. - dir_util.create_tree (base_dir, files, - verbose=self.verbose, dry_run=self.dry_run) + # put 'files' there; the 'mkpath()' is just so we don't die + # if the manifest happens to be empty. + self.mkpath(base_dir) + dir_util.create_tree(base_dir, files, + verbose=self.verbose, dry_run=self.dry_run) # And walk over the list of files, either making a hard link (if # os.link exists) to each one that doesn't already exist in its @@ -423,10 +425,16 @@ class sdist (Command): link = None msg = "copying files to %s..." % base_dir - self.announce (msg) + if not files: + self.warn("no files to distribute -- empty manifest?") + else: + self.announce (msg) for file in files: - dest = os.path.join (base_dir, file) - self.copy_file (file, dest, link=link) + if not os.path.isfile(file): + self.warn("'%s' not a regular file -- skipping" % file) + else: + dest = os.path.join (base_dir, file) + self.copy_file (file, dest, link=link) # make_release_tree () |