From 712986e2fdeb8888ec3d96e9d14ae4f2d19f6260 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Fri, 29 Jun 2018 14:33:26 +0800 Subject: [PATCH] Remove the global version varibales like MAJOR and so on --- python/setup.py.in | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/python/setup.py.in b/python/setup.py.in index 38c79d8399b..a27eb5d5827 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -20,7 +20,7 @@ def git_commit(): def _get_version_detail(idx): assert idx < 3 - version_details = '${PADDLE_VERSION}'.split('.') + version_details = '@PADDLE_VERSION@'.split('.') if len(version_details) == 3: if re.match('[0-9]+', version_details[idx]): return int(version_details[idx]) @@ -50,14 +50,15 @@ def get_patch(): def is_taged(): try: - # release/0.13.0 - # git describe --exact-match --tags - cmd = ['git', 'rev-parse', 'HEAD'] - git_commit = subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0].strip() + cmd = ['git', 'describe', '--exact-match', '--tags'] + git_tag = subprocess.Popen(cmd, stdout = subprocess.PIPE).communicate()[0].strip() except: - git_commit = 'Unknown' - return git_commit - return ISTAGED + return False + + if git_tag.replace('v', '') == '@PADDLE_VERSION@': + return True + else: + return False; def write_version_py(filename='paddle/version.py'): cnt = ''' -- GitLab