Mercurial > hg
changeset 8754:31c90d12f86c
Merge with crew
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 08 Jun 2009 18:16:32 -0500 |
parents | 107af208ed0b (diff) 48da69ff79bd (current diff) |
children | a2b4ddee3785 6556d4145122 |
files | |
diffstat | 1 files changed, 13 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Fri Jun 05 15:08:45 2009 +0200 +++ b/setup.py Mon Jun 08 18:16:32 2009 -0500 @@ -97,10 +97,7 @@ except ImportError: pass -def getversion(): - if not os.path.exists('.hg'): - return None # not in a repository - +if os.path.exists('.hg'): # execute hg out of this directory with a custom environment which # includes the pure Python modules in mercurial/pure pypath = os.environ.get('PYTHONPATH', '') @@ -108,6 +105,7 @@ os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath]) os.environ['HGRCPATH'] = '' # do not read any config file cmd = '%s hg id -it' % sys.executable + version = None try: l = os.popen(cmd).read().split() @@ -122,16 +120,18 @@ version = l[-1] # latest tag or revision number if version.endswith('+'): version += time.strftime('%Y%m%d') - return version -version = getversion() -if version: - f = file("mercurial/__version__.py", "w") - f.write('# this file is autogenerated by setup.py\n') - f.write('version = "%s"\n' % version) - f.close() -else: - version = "unknown" + if version: + f = file("mercurial/__version__.py", "w") + f.write('# this file is autogenerated by setup.py\n') + f.write('version = "%s"\n' % version) + f.close() + +try: + from mercurial import __version__ + version = __version__.version +except ImportError: + version = 'unknown' class install_package_data(install_data): def finalize_options(self):