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

phillip.eby python-checkins at python.org
Tue Jul 18 18:32:08 CEST 2006


Author: phillip.eby
Date: Tue Jul 18 18:32:07 2006
New Revision: 50701

Modified:
   sandbox/trunk/setuptools/setuptools/command/sdist.py
Log:
Edit an sdist's setup.cfg to include any egg_info options that were used 
to build it.


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:32:07 2006
@@ -173,28 +173,28 @@
             )
 
 
+    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
+            # we don't want to change the source version
+            os.unlink(dest)
+            self.copy_file('setup.cfg', dest)
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+        from setopt import edit_config
+        edit_config(dest, {'egg_info':settings})
 
 
 


More information about the Python-checkins mailing list