setup.py
changeset 7721 a1138f437640
parent 7720 b6c2cb40e664
child 7722 103127a8cbdb
equal deleted inserted replaced
7720:b6c2cb40e664 7721:a1138f437640
    94 
    94 
    95 except ImportError:
    95 except ImportError:
    96     pass
    96     pass
    97 
    97 
    98 try:
    98 try:
    99     l = os.popen('hg id -it').read().split()
    99     # execute hg out of this directory with a custom environment which
       
   100     # includes the pure Python modules in mercurial/pure
       
   101     pypath = os.environ.get('PYTHONPATH', '')
       
   102     purepath = os.path.join('mercurial', 'pure')
       
   103     os.environ['PYTHONPATH'] = os.pathsep.join(['mercurial', purepath, pypath])
       
   104     cmd = '%s id -it' % os.path.join('.', 'hg')
       
   105     l = os.popen(cmd).read().split()
       
   106     os.environ['PYTHONPATH'] = pypath
   100     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
   107     while len(l) > 1 and l[-1][0].isalpha(): # remove non-numbered tags
   101         l.pop()
   108         l.pop()
   102     version = l and l[-1] or 'unknown' # latest tag or revision number
   109     version = l and l[-1] or 'unknown' # latest tag or revision number
   103     if version.endswith('+'):
   110     if version.endswith('+'):
   104         version += time.strftime('%Y%m%d')
   111         version += time.strftime('%Y%m%d')