setup.py
changeset 238 e4a389eca1b9
parent 219 405a9c1dc7bf
equal deleted inserted replaced
237:0a0049700af5 238:e4a389eca1b9
     1 #!/usr/bin/env python
     1 #!/usr/bin/env python
     2 # $Id$
     2 # $Id$
     3 
     3 
     4 from distutils.core import setup
     4 from distutils.core import setup
     5 import hgkw.version
     5 import os, time
     6 
     6 
     7 # specify version, Mercurial version otherwise
     7 # specify version, Mercurial version otherwise
     8 version = ''
     8 version = ''
     9 
     9 
    10 hgkw.version.rememberversion(version)
    10 unknown_version = 'unknown'
       
    11 
       
    12 def getversion():
       
    13     global version, unknown_version
       
    14     if not version and os.path.isdir('.hg'):
       
    15         p = os.popen('hg --quiet identify 2> %s' % os.devnull)
       
    16         ident = p.read()[:-1]
       
    17         if not p.close() and ident:
       
    18             if ident[-1] != '+':
       
    19                 version = ident
       
    20             else:
       
    21                 version = ident[:-1]
       
    22                 version += time.strftime('+%Y%m%d')
       
    23     return version or unknown_version
    11 
    24 
    12 setup(name='hgkw',
    25 setup(name='hgkw',
    13       version=hgkw.version.getversion(),
    26       version=getversion(),
    14       description='Mercurial keyword extension (standalone)',
    27       description='Mercurial keyword extension (standalone)',
    15       author='Christian Ebert',
    28       author='Christian Ebert',
    16       author_email='blacktrash@gmx.net',
    29       author_email='blacktrash@gmx.net',
    17       url='http://www.blacktrash.org/hg/hgkeyword/',
    30       url='http://www.blacktrash.org/hg/hgkeyword/',
    18       license='GNU GPL',
    31       license='GNU GPL',