[Python-checkins] CVS: distutils/distutils/command sdist.py,1.32,1.33

Greg Ward python-dev@python.org
Tue, 20 Jun 2000 20:29:59 -0700


Update of /cvsroot/python/distutils/distutils/command
In directory slayer.i.sourceforge.net:/tmp/cvs-serv21805

Modified Files:
	sdist.py 
Log Message:
Fix inspired by Rene Liebscher: if setup script is newer than the
manifest, regenerate the manifest.


Index: sdist.py
===================================================================
RCS file: /cvsroot/python/distutils/distutils/command/sdist.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -r1.32 -r1.33
*** sdist.py	2000/06/08 01:22:48	1.32
--- sdist.py	2000/06/21 03:29:57	1.33
***************
*** 174,185 ****
          depends on the user's options and the state of the filesystem.
          """
          template_exists = os.path.isfile (self.template)
          if template_exists:
              template_newer = newer (self.template, self.manifest)
  
          # 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 not template_exists:
--- 174,208 ----
          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 setup_newer)) or
!             self.force_manifest or self.manifest_only):
  
              if not template_exists: