Mercurial > hg-stable
changeset 7721:a1138f437640
setup: get version number using pure Python modules
author | Martin Geisler <mg@daimi.au.dk> |
---|---|
date | Thu, 29 Jan 2009 19:25:25 +0100 |
parents | b6c2cb40e664 |
children | 103127a8cbdb |
files | setup.py |
diffstat | 1 files changed, 8 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/setup.py Wed Jan 28 10:32:15 2009 +0100 +++ b/setup.py Thu Jan 29 19:25:25 2009 +0100 @@ -96,7 +96,14 @@ pass try: - l = os.popen('hg id -it').read().split() + # execute hg out of this directory with a custom environment which + # includes the pure Python modules in mercurial/pure + pypath = os.environ.get('PYTHONPATH', '') + purepath = os.path.join('mercurial', 'pure') + os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath]) + cmd = '%s id -it' % os.path.join('.', 'hg') + l = os.popen(cmd).read().split() + os.environ['PYTHONPATH'] = pypath while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags l.pop() version = l and l[-1] or 'unknown' # latest tag or revision number