aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2005-07-08 04:45:58 +0000
committerPJ Eby <distutils-sig@python.org>2005-07-08 04:45:58 +0000
commit56fcb8fdcc377acf0d74430a3d2d4dbffe306d44 (patch)
treee80f347416da36f2d765d0c50d066bf6997dc085
parent5b4efda5148fc5ac79b5aaf02eb4dbf6c68c866b (diff)
downloadexternal_python_setuptools-56fcb8fdcc377acf0d74430a3d2d4dbffe306d44.tar.gz
external_python_setuptools-56fcb8fdcc377acf0d74430a3d2d4dbffe306d44.tar.bz2
external_python_setuptools-56fcb8fdcc377acf0d74430a3d2d4dbffe306d44.zip
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. --HG-- branch : setuptools extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4041092
-rw-r--r--pkg_resources.py2
-rwxr-xr-xsetuptools/command/egg_info.py18
2 files changed, 10 insertions, 10 deletions
diff --git a/pkg_resources.py b/pkg_resources.py
index 2ba7ba41..583a5c84 100644
--- a/pkg_resources.py
+++ b/pkg_resources.py
@@ -1299,7 +1299,7 @@ class Distribution(object):
except AttributeError:
for line in self._get_metadata('PKG-INFO'):
if line.lower().startswith('version:'):
- self._version = line.split(':',1)[1].strip()
+ self._version = safe_version(line.split(':',1)[1].strip())
return self._version
else:
raise AttributeError(
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index 0223becb..6fffbe24 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -60,13 +60,13 @@ class egg_info(Command):
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 @@ class egg_info(Command):
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 @@ class egg_info(Command):
f.close()
-
-
def tagged_version(self):
version = self.distribution.get_version()
if self.tag_build: