mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-08 14:12:05 +00:00
version.properties bump
This commit is contained in:
parent
4588995fba
commit
279149e40f
21
bin/bump_version.py
Executable file → Normal file
21
bin/bump_version.py
Executable file → Normal file
@ -1,25 +1,16 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
"""Bump the version number"""
|
"""Bump the version number"""
|
||||||
|
|
||||||
version_filename = "setup.py"
|
|
||||||
|
|
||||||
lines = None
|
lines = None
|
||||||
|
|
||||||
with open(version_filename, 'r', encoding='utf-8') as f:
|
with open('version.properties', 'r', encoding='utf-8') as f:
|
||||||
lines = f.readlines()
|
lines = f.readlines()
|
||||||
|
|
||||||
with open(version_filename, 'w', encoding='utf-8') as f:
|
with open('version.properties', 'w', encoding='utf-8') as f:
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if line.lstrip().startswith("version="):
|
if line.lstrip().startswith("build = "):
|
||||||
# get rid of quotes around the version
|
words = line.split(" = ")
|
||||||
line = line.replace('"', '')
|
ver = f'build = {int(words[1]) + 1}'
|
||||||
# get rid of trailing comma
|
f.write(f'{ver}\n')
|
||||||
line = line.replace(",", "")
|
|
||||||
# split on '='
|
|
||||||
words = line.split("=")
|
|
||||||
# split the version into parts (by period)
|
|
||||||
v = words[1].split(".")
|
|
||||||
ver = f'{v[0]}.{v[1]}.{int(v[2]) + 1}'
|
|
||||||
f.write(f' version="{ver}",\n')
|
|
||||||
else:
|
else:
|
||||||
f.write(line)
|
f.write(line)
|
||||||
|
Loading…
Reference in New Issue
Block a user