[Python-checkins] python/nondist/sandbox/setuptools/setuptools/command egg_info.py, 1.2, 1.3

pje@users.sourceforge.net pje at users.sourceforge.net
Fri Jul 8 06:46:00 CEST 2005


Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15749/setuptools/command

Modified Files:
	egg_info.py 
Log Message:
The "egg_info" command now always sets the distribution metadata to "safe"
forms of the distribution name and version, so that distribution files will
be generated with parseable names (i.e., ones that don't include '-' in the
name or version).  Also, this means that if you use the various ``--tag``
options of "egg_info", any distributions generated will use the tags in the
version, not just egg distributions.


Index: egg_info.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/egg_info.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- egg_info.py	7 Jul 2005 02:01:54 -0000	1.2
+++ egg_info.py	8 Jul 2005 04:45:58 -0000	1.3
@@ -60,13 +60,13 @@
         self.ensure_dirname('egg_base')
         self.egg_info = os.path.join(self.egg_base, self.egg_name+'.egg-info')
 
-
-
-
-
-
-
-
+        # Set package version and name for the benefit of dumber commands
+        # (e.g. sdist, bdist_wininst, etc.)  We escape '-' so filenames will
+        # be more machine-parseable.
+        #
+        metadata = self.distribution.metadata
+        metadata.version = self.egg_version.replace('-','_')
+        metadata.name    = self.egg_name.replace('-','_')
 
 
 
@@ -90,6 +90,8 @@
             metadata.version, oldver = self.egg_version, metadata.version
             metadata.name, oldname   = self.egg_name, metadata.name
             try:
+                # write unescaped data to PKG-INFO, so older pkg_resources
+                # can still parse it
                 metadata.write_pkg_info(self.egg_info)
             finally:
                 metadata.name, metadata.version = oldname, oldver
@@ -119,8 +121,6 @@
             f.close()
 
 
-
-            
     def tagged_version(self):
         version = self.distribution.get_version()
         if self.tag_build:



More information about the Python-checkins mailing list