mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
Fix cmake version detection from git tag.
This commit is contained in:
committed by
Lorenz Meier
parent
249d7f00ce
commit
b1173f1f62
+2
-2
@@ -244,7 +244,7 @@ endif()
|
|||||||
|
|
||||||
# version info from git
|
# version info from git
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND Tools/tag_to_version.py ${PX4_SOURCE_DIR}
|
COMMAND Tools/tag_to_version.py --root ${PX4_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE version
|
OUTPUT_VARIABLE version
|
||||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
@@ -255,7 +255,7 @@ execute_process(
|
|||||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
set(package-contact "px4users@googlegroups.com")
|
set(package-contact "px4users@googlegroups.com")
|
||||||
message(STATUS "PX4 VERSION: ${version}")
|
message(STATUS "VERSION: ${version}")
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# find programs and packages
|
# find programs and packages
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import subprocess
|
||||||
|
import os
|
||||||
|
import argparse
|
||||||
|
|
||||||
|
p = argparse.ArgumentParser('finds major minor patch version from git tag')
|
||||||
|
p.add_argument('--root', help="root of git repo", default=".")
|
||||||
|
args = p.parse_args()
|
||||||
|
os.chdir(args.root)
|
||||||
|
p= subprocess.Popen(
|
||||||
|
'git describe --always --tags'.split(),
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
stdout, stderr = p.communicate()
|
||||||
|
res = stdout.split('-')[0].split('.')
|
||||||
|
major = res[0].replace('v','')
|
||||||
|
minor = res[1]
|
||||||
|
patch = res[2]
|
||||||
|
print("{:s}.{:s}.{:s}".format(major, minor, patch))
|
||||||
Reference in New Issue
Block a user