diff -r 0b2ee57dfdb1 -r 9626819b2e3d setup.py --- a/setup.py Tue Jan 13 23:17:19 2009 +0100 +++ b/setup.py Sat Jan 10 18:02:38 2009 -0600 @@ -26,15 +26,13 @@ raise SystemExit( "Couldn't import standard zlib (incomplete Python install).") -import os +import os, time import shutil import tempfile from distutils.core import setup, Extension from distutils.command.install_data import install_data from distutils.ccompiler import new_compiler -import mercurial.version - extra = {} scripts = ['hg'] if os.name == 'nt': @@ -95,8 +93,21 @@ except ImportError: pass -# specify version string, otherwise 'hg identify' will be used: -version = '' +try: + l = os.popen('hg id -it').read().split() + while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags + l.pop() + version = l[-1] or 'unknown' # latest tag or revision number + if version.endswith('+'): + version += time.strftime('%Y%m%d') + +except OSError: + version = "unknown" + +f = file("mercurial/__version__.py", "w") +f.write('# this file is autogenerated by setup.py\n') +f.write('version = "%s"\n' % version) +f.close() class install_package_data(install_data): def finalize_options(self): @@ -104,7 +115,6 @@ ('install_lib', 'install_dir')) install_data.finalize_options(self) -mercurial.version.remember_version(version) cmdclass = {'install_data': install_package_data} ext_modules=[ @@ -140,7 +150,7 @@ pass setup(name='mercurial', - version=mercurial.version.get_version(), + version=version, author='Matt Mackall', author_email='mpm@selenic.com', url='http://selenic.com/mercurial',