summaryrefslogtreecommitdiffstats
path: root/Lib/distutils/command
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-06-21 03:29:57 (GMT)
committerGreg Ward <gward@python.net>2000-06-21 03:29:57 (GMT)
commitb2db0eb695d2d62cb1a74c51bb005a23821a76ce (patch)
treeb8f08154a99904c79e3a24a8e6f5e7477170f8fd /Lib/distutils/command
parentf6451c46d7a00d9e82deec23c6446110e4ef305f (diff)
downloadcpython-b2db0eb695d2d62cb1a74c51bb005a23821a76ce.zip
cpython-b2db0eb695d2d62cb1a74c51bb005a23821a76ce.tar.gz
cpython-b2db0eb695d2d62cb1a74c51bb005a23821a76ce.tar.bz2
Fix inspired by Rene Liebscher: if setup script is newer than the
manifest, regenerate the manifest.
Diffstat (limited to 'Lib/distutils/command')
-rw-r--r--Lib/distutils/command/sdist.py29
1 files changed, 26 insertions, 3 deletions
diff --git a/Lib/distutils/command/sdist.py b/Lib/distutils/command/sdist.py
index 48e9793..ded8ec2 100644
--- a/Lib/distutils/command/sdist.py
+++ b/Lib/distutils/command/sdist.py
@@ -173,14 +173,37 @@ class sdist (Command):
reading the manifest, or just using the default file set -- it all
depends on the user's options and the state of the filesystem.
"""
+
+ # If we have a manifest template, see if it's newer than the
+ # manifest; if so, we'll regenerate the manifest.
template_exists = os.path.isfile (self.template)
if template_exists:
template_newer = newer (self.template, self.manifest)
+ # The contents of the manifest file almost certainly depend on the
+ # setup script as well as the manifest template -- so if the setup
+ # script is newer than the manifest, we'll regenerate the manifest
+ # from the template. (Well, not quite: if we already have a
+ # manifest, but there's no template -- which will happen if the
+ # developer elects to generate a manifest some other way -- then we
+ # can't regenerate the manifest, so we don't.)
+ setup_newer = newer(sys.argv[0], self.manifest)
+
+ # cases:
+ # 1) no manifest, template exists: generate manifest
+ # (covered by 2a: no manifest == template newer)
+ # 2) manifest & template exist:
+ # 2a) template or setup script newer than manifest:
+ # regenerate manifest
+ # 2b) manifest newer than both:
+ # do nothing (unless --force or --manifest-only)
+ # 3) manifest exists, no template:
+ # do nothing (unless --force or --manifest-only)
+ # 4) no manifest, no template: generate w/ warning ("defaults only")
+
# Regenerate the manifest if necessary (or if explicitly told to)
- if ((template_exists and template_newer) or
- self.force_manifest or
- self.manifest_only):
+ if ((template_exists and (template_newer or setup_newer)) or
+ self.force_manifest or self.manifest_only):
if not template_exists:
self.warn (("manifest template '%s' does not exist " +