mirror of
https://github.com/bendtherules/Patient-counter-esp8266.git
synced 2026-08-18 13:52:39 +00:00
Add build number pre-script
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
FILENAME_BUILDNO = 'versioning'
|
||||
FILENAME_VERSION_H = 'include/version.h'
|
||||
version = 'v0.1.'
|
||||
|
||||
import datetime
|
||||
|
||||
build_no = 0
|
||||
try:
|
||||
with open(FILENAME_BUILDNO) as f:
|
||||
build_no = int(f.readline()) + 1
|
||||
except:
|
||||
print('Starting build number from 1..')
|
||||
build_no = 1
|
||||
with open(FILENAME_BUILDNO, 'w+') as f:
|
||||
f.write(str(build_no))
|
||||
print('Build number: {}'.format(build_no))
|
||||
|
||||
hf = """\
|
||||
#ifndef BUILD_NUMBER
|
||||
#define BUILD_NUMBER {}
|
||||
#endif
|
||||
#ifndef VERSION
|
||||
#define VERSION "{} - {}"
|
||||
#endif
|
||||
#ifndef VERSION_SHORT
|
||||
#define VERSION_SHORT "{}"
|
||||
#endif
|
||||
""".format(build_no, version+str(build_no), datetime.datetime.now(), version+str(build_no))
|
||||
with open(FILENAME_VERSION_H, 'w+') as f:
|
||||
f.write(hf)
|
||||
Reference in New Issue
Block a user