mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
refactor: factor out autoversioning.py
BREAKING CHANGE
This commit is contained in:
parent
b51c9953ed
commit
09b622b923
@ -224,7 +224,6 @@ monitor_filters =
|
|||||||
esp32_exception_decoder
|
esp32_exception_decoder
|
||||||
board_build.partitions = min_spiffs.csv
|
board_build.partitions = min_spiffs.csv
|
||||||
build_flags =
|
build_flags =
|
||||||
!python tools/autoversioning.py
|
|
||||||
!python tools/git_rev.py
|
!python tools/git_rev.py
|
||||||
|
|
||||||
-DENABLE_ADHOC=${wifi.enableadhoc}
|
-DENABLE_ADHOC=${wifi.enableadhoc}
|
||||||
|
|||||||
@ -1,28 +0,0 @@
|
|||||||
FILENAME_VERSION = 'tools/version.txt'
|
|
||||||
build_no = 'v0.0.0'
|
|
||||||
try:
|
|
||||||
with open(FILENAME_VERSION) as f:
|
|
||||||
build_no = f.readline()
|
|
||||||
if build_no == '':
|
|
||||||
raise Exception("Empty file")
|
|
||||||
version = build_no.split('v')
|
|
||||||
version = version[1].split('.')
|
|
||||||
first_num = int(version[0])
|
|
||||||
second_num = int(version[1])
|
|
||||||
last_num = int(version[2])
|
|
||||||
if last_num <= 9:
|
|
||||||
last_num += 1
|
|
||||||
elif second_num <= 9 and last_num >= 9:
|
|
||||||
second_num += 1
|
|
||||||
elif second_num and last_num >= 9:
|
|
||||||
first_num += 1
|
|
||||||
second_num = 0
|
|
||||||
last_num = 0
|
|
||||||
else:
|
|
||||||
raise Exception("Invalid version number")
|
|
||||||
build_no = 'v' + str(first_num) + '.' + str(second_num) + '.' + str(last_num)
|
|
||||||
except:
|
|
||||||
build_no = "v0.0.1"
|
|
||||||
with open(FILENAME_VERSION, 'w+') as f:
|
|
||||||
f.write(build_no)
|
|
||||||
print("-DVERSION={0}".format(build_no))
|
|
||||||
@ -7,8 +7,8 @@ project = project.split("/")
|
|||||||
project = project[len(project)-1]
|
project = project[len(project)-1]
|
||||||
|
|
||||||
# Get 0.0.0 version from latest Git tag
|
# Get 0.0.0 version from latest Git tag
|
||||||
#tagcmd = "git describe --tags --abbrev=0"
|
tagcmd = "git describe --tags --abbrev=0"
|
||||||
#version = subprocess.check_output(tagcmd, shell=True).decode().strip()
|
version = subprocess.check_output(tagcmd, shell=True).decode().strip()
|
||||||
|
|
||||||
# Get latest commit short from Git
|
# Get latest commit short from Git
|
||||||
revcmd = "git log --pretty=format:'%h' -n 1"
|
revcmd = "git log --pretty=format:'%h' -n 1"
|
||||||
@ -20,6 +20,6 @@ branch = subprocess.check_output(branchcmd, shell=True).decode().strip()
|
|||||||
|
|
||||||
# Make all available for use in the macros
|
# Make all available for use in the macros
|
||||||
print("-DPIO_SRC_NAM={0}".format(project))
|
print("-DPIO_SRC_NAM={0}".format(project))
|
||||||
#print("-DPIO_SRC_TAG={0}".format(version))
|
print("-DPIO_SRC_TAG={0}".format(version))
|
||||||
print("-DPIO_SRC_REV={0}".format(commit))
|
print("-DPIO_SRC_REV={0}".format(commit))
|
||||||
print("-DPIO_SRC_BRH={0}".format(branch))
|
print("-DPIO_SRC_BRH={0}".format(branch))
|
||||||
Loading…
Reference in New Issue
Block a user