From fe49e4690450b2615519a86e4a1f79a1dfe4a8d9 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Fri, 6 Jul 2018 15:59:29 +0800 Subject: [PATCH] Fix the problem that CMake do not support {} regex Change patch version to str --- cmake/version.cmake | 2 +- python/setup.py.in | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/version.cmake b/cmake/version.cmake index 4a86ad2e09..79b8e8ac49 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -2,7 +2,7 @@ set(PADDLE_VERSION $ENV{PADDLE_VERSION}) set(tmp_version "HEAD") set(TAG_VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(\\.(a|b|rc)\\.[0-9]+)?") -set(COMMIT_VERSION_REGEX "[0-9a-f]+") +set(COMMIT_VERSION_REGEX "[0-9a-f]+[0-9a-f]+[0-9a-f]+[0-9a-f]+[0-9a-f]+") while ("${PADDLE_VERSION}" STREQUAL "") execute_process( COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0 --always ${tmp_version} diff --git a/python/setup.py.in b/python/setup.py.in index 6e21512b86..0fd676a702 100644 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -32,13 +32,13 @@ def _get_version_detail(idx): return 0 def get_major(): - return _get_version_detail(0) + return int(_get_version_detail(0)) def get_minor(): - return _get_version_detail(1) + return int(_get_version_detail(1)) def get_patch(): - return _get_version_detail(2) + return str(_get_version_detail(2)) def is_taged(): try: @@ -56,10 +56,10 @@ def write_version_py(filename='paddle/version.py'): cnt = ''' # THIS FILE IS GENERATED FROM PADDLEPADDLE SETUP.PY # -full_version = '%(major)d.%(minor)d.%(patch)d' +full_version = '%(major)d.%(minor)d.%(patch)s' major = '%(major)d' minor = '%(minor)d' -patch = '%(patch)d' +patch = '%(patch)s' rc = '%(rc)d' istaged = %(istaged)s commit = '%(commit)s' -- GitLab