--- a/setup.py Sun Sep 02 15:46:18 2007 +0200
+++ b/setup.py Sun Sep 02 17:04:22 2007 +0200
@@ -2,15 +2,28 @@
# $Id$
from distutils.core import setup
-import hgkw.version
+import os, time
# specify version, Mercurial version otherwise
version = ''
-hgkw.version.rememberversion(version)
+unknown_version = 'unknown'
+
+def getversion():
+ global version, unknown_version
+ if not version and os.path.isdir('.hg'):
+ p = os.popen('hg --quiet identify 2> %s' % os.devnull)
+ ident = p.read()[:-1]
+ if not p.close() and ident:
+ if ident[-1] != '+':
+ version = ident
+ else:
+ version = ident[:-1]
+ version += time.strftime('+%Y%m%d')
+ return version or unknown_version
setup(name='hgkw',
- version=hgkw.version.getversion(),
+ version=getversion(),
description='Mercurial keyword extension (standalone)',
author='Christian Ebert',
author_email='blacktrash@gmx.net',