提交 1af7d5a2 编写于 作者: M minqiyang

Change the incorrect version result from UNKNOWN to 0

Replace {} to + in cmake regex match
上级 37a43221
......@@ -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]{5,40}")
set(COMMIT_VERSION_REGEX "[0-9a-f]+")
while ("${PADDLE_VERSION}" STREQUAL "")
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --abbrev=0 --always ${tmp_version}
......@@ -15,7 +15,7 @@ while ("${PADDLE_VERSION}" STREQUAL "")
if (${GIT_TAG_NAME} MATCHES "${COMMIT_VERSION_REGEX}")
# if no tag was found, set PADDLE_VERSION to latest
set(PADDLE_VERSION "latest")
elseif (${GIT_TAG_NAME} MATCHES "v${VERSION_REGEX}")
elseif (${GIT_TAG_NAME} MATCHES "v${TAG_VERSION_REGEX}")
string(REPLACE "v" "" PADDLE_VERSION ${GIT_TAG_NAME})
else() # otherwise, get the previous git tag name.
set(tmp_version "${GIT_TAG_NAME}~1")
......
......@@ -29,7 +29,7 @@ def _get_version_detail(idx):
if len(version_details) == 3:
return version_details[idx]
return 'UNKNOWN'
return 0
def get_major():
return _get_version_detail(0)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册