aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/command
diff options
context:
space:
mode:
authorPJ Eby <distutils-sig@python.org>2006-07-18 16:55:23 +0000
committerPJ Eby <distutils-sig@python.org>2006-07-18 16:55:23 +0000
commit3536c85d4ef8a3e879a4c6e2ae87fff8c3bfec12 (patch)
treebff81a9d3599947ac79591ab1ed690ba3e9760e8 /setuptools/command
parent5afddb363fe7156d26d7faf0c3cc51e7a4c14fc6 (diff)
downloadexternal_python_setuptools-3536c85d4ef8a3e879a4c6e2ae87fff8c3bfec12.tar.gz
external_python_setuptools-3536c85d4ef8a3e879a4c6e2ae87fff8c3bfec12.tar.bz2
external_python_setuptools-3536c85d4ef8a3e879a4c6e2ae87fff8c3bfec12.zip
Source distributions now always include a ``setup.cfg`` file that explicitly
sets ``egg_info`` options such that they produce an identical version number to the source distribution's version number. (Previously, the default version number could be different due to the use of ``--tag-date``, or if the version was overridden on the command line that built the source distribution.) (backport from trunk) --HG-- branch : setuptools-0.6 extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4050703
Diffstat (limited to 'setuptools/command')
-rwxr-xr-xsetuptools/command/egg_info.py34
-rwxr-xr-xsetuptools/command/sdist.py24
2 files changed, 29 insertions, 29 deletions
diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py
index f8e78e96..e1203b9f 100755
--- a/setuptools/command/egg_info.py
+++ b/setuptools/command/egg_info.py
@@ -39,7 +39,7 @@ class egg_info(Command):
- def initialize_options (self):
+ def initialize_options(self):
self.egg_name = None
self.egg_version = None
self.egg_base = None
@@ -48,16 +48,16 @@ class egg_info(Command):
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 @@ class egg_info(Command):
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 @@ class egg_info(Command):
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 @@ class egg_info(Command):
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 @@ class egg_info(Command):
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 @@ class egg_info(Command):
): 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
diff --git a/setuptools/command/sdist.py b/setuptools/command/sdist.py
index 0292efe2..4cc0ae1f 100755
--- a/setuptools/command/sdist.py
+++ b/setuptools/command/sdist.py
@@ -173,18 +173,18 @@ class sdist(_sdist):
)
-
-
-
-
-
-
-
-
-
-
-
-
+ 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
+ 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)
+
+ self.get_finalized_command('egg_info').save_version_info(dest)