Skip to content

Commit c158e19

Browse files
committed
added a script to update version in the buildVars.py automatically if it as not been changed but is confirmed in a commit. this can be used manually, or automatically with a post commit hook.
added ignore .json files.
1 parent ebf9d29 commit c158e19

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,5 @@ addon/doc/en/
77
*.py[co]
88
*.nvda-addon
99
.sconsign.dblite
10+
*.code-workspace
11+
*.json

updateVersion.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import re, sys
2+
3+
if len(sys.argv) < 2:
4+
print("the version was not detected")
5+
exit(1)
6+
version = sys.argv[1]
7+
print(f"the version recognized is: {version}")
8+
with open("buildVars.py", 'r+', encoding='utf-8') as f:
9+
text = f.read()
10+
text = re.sub('"addon_version" *:.*,', f'"addon_version" : "{version}",', text)
11+
f.seek(0)
12+
f.write(text)
13+
f.truncate()

0 commit comments

Comments
 (0)