[Python-checkins] r50702 - sandbox/trunk/setuptools/setuptools/command/egg_info.py sandbox/trunk/setuptools/setuptools/command/sdist.py

phillip.eby python-checkins at python.org
Tue Jul 18 18:49:43 CEST 2006


Author: phillip.eby
Date: Tue Jul 18 18:49:42 2006
New Revision: 50702

Modified:
   sandbox/trunk/setuptools/setuptools/command/egg_info.py
   sandbox/trunk/setuptools/setuptools/command/sdist.py
Log:
Make sdist-from-sdist builds keep the exact same version number, even if 
--tag-date was used to build the original sdist.


Modified: sandbox/trunk/setuptools/setuptools/command/egg_info.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/egg_info.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/egg_info.py	Tue Jul 18 18:49:42 2006
@@ -39,7 +39,7 @@
 
 
 
-    def initialize_options (self):
+    def initialize_options(self):
         self.egg_name = None
         self.egg_version = None
         self.egg_base = None
@@ -48,16 +48,16 @@
         self.tag_svn_revision = 0
         self.tag_date = 0
         self.broken_egg_info = False
+        self.vtags = None
 
-
-
-
-
-
-
-
-
-
+    def save_version_info(self, filename):
+        from setopt import edit_config
+        edit_config(
+            filename,
+            {'egg_info':
+                {'tag_svn_revision':0, 'tag_date': 0, 'tag_build': self.tags()}
+            }
+        )
 
 
 
@@ -82,6 +82,7 @@
 
     def finalize_options (self):
         self.egg_name = safe_name(self.distribution.get_name())
+        self.vtags = self.tags()
         self.egg_version = self.tagged_version()
 
         try:
@@ -120,7 +121,6 @@
             self.distribution._patched_dist = None
 
 
-
     def write_or_delete_file(self, what, filename, data, force=False):
         """Write `data` to `filename` or delete if empty
 
@@ -159,8 +159,8 @@
         if not self.dry_run:
             os.unlink(filename)
 
-
-
+    def tagged_version(self):
+        return safe_version(self.distribution.get_version() + self.vtags)
 
     def run(self):
         self.mkpath(self.egg_info)
@@ -170,8 +170,8 @@
             writer(self, ep.name, os.path.join(self.egg_info,ep.name))
         self.find_sources()
 
-    def tagged_version(self):
-        version = self.distribution.get_version()
+    def tags(self):
+        version = ''
         if self.tag_build:
             version+=self.tag_build
         if self.tag_svn_revision and (
@@ -179,7 +179,7 @@
         ):  version += '-r%s' % self.get_svn_revision()
         if self.tag_date:
             import time; version += time.strftime("-%Y%m%d")
-        return safe_version(version)
+        return version
 
     def get_svn_revision(self):
         revision = 0

Modified: sandbox/trunk/setuptools/setuptools/command/sdist.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/sdist.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/sdist.py	Tue Jul 18 18:49:42 2006
@@ -173,19 +173,10 @@
             )
 
 
-    def make_release_tree (self, base_dir, files):
+    def make_release_tree(self, base_dir, files):
         _sdist.make_release_tree(self, base_dir, files)
 
         # Save any egg_info command line options used to create this sdist
-        settings = {}
-        dist = self.distribution
-        for opt,(src,val) in dist.get_option_dict('egg_info').items():
-            if src=="command line":
-                settings[opt] = val
-
-        if not settings:
-            return  # nothing to change
-
         dest = os.path.join(base_dir, 'setup.cfg')
         if hasattr(os,'link') and os.path.exists(dest):
             # unlink and re-copy, since it might be hard-linked, and
@@ -193,8 +184,17 @@
             os.unlink(dest)
             self.copy_file('setup.cfg', dest)
 
-        from setopt import edit_config
-        edit_config(dest, {'egg_info':settings})
+        self.get_finalized_command('egg_info').save_version_info(dest)
+
+
+
+
+
+
+
+
+
+
 
 
 


More information about the Python-checkins mailing list