Commit 5b7cd9bb authored by Denis Bilenko's avatar Denis Bilenko

util/set_version.py: switch from hg to git

parent 21e4be8a
...@@ -14,20 +14,20 @@ from distutils.version import LooseVersion ...@@ -14,20 +14,20 @@ from distutils.version import LooseVersion
version_re = re.compile("__version__\s*=\s*'([^']+)'", re.M) version_re = re.compile("__version__\s*=\s*'([^']+)'", re.M)
version_info_re = re.compile(r"version_info\s*=\s*([^\n]+)") version_info_re = re.compile(r"version_info\s*=\s*([^\n]+)")
changeset_re = re.compile("__changeset__\s*=\s*'([^']+)'", re.M)
hg_changeset_re = re.compile('changeset:\s+([^\s$]+)', re.M)
strict_version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE) strict_version_re = re.compile(r'^(\d+) \. (\d+) (\. (\d+))? ([ab](\d+))?$', re.VERBOSE)
def get_changeset(): def read(command):
hg_head_command = os.popen('hg head') popen = os.popen(command)
data = hg_head_command.read() data = popen.read()
retcode = hg_head_command.close() retcode = popen.close()
if retcode: if retcode:
sys.exit('Failed (%s) to run "hg head"' % retcode) sys.exit('Failed (%s) to run %r' % (retcode, command))
m = hg_changeset_re.search(data) return data.strip()
if m is not None:
return m.group(1)
def get_changeset():
return read('git describe --tags --always --dirty --long')
def get_version_info(version): def get_version_info(version):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment