-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_version.py
34 lines (24 loc) · 969 Bytes
/
update_version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
# run `python update_version.py` to update the version in the files
def updateVersionInFile(file_path, version):
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
with open(file_path, 'w', encoding='utf-8') as file:
for line in lines:
if line.startswith('__version__'):
file.write(f"__version__ = '{version}'\n")
else:
file.write(line)
def main():
version_file_path = os.path.join(os.path.dirname(__file__), 'VERSION')
with open(version_file_path, 'r', encoding='utf-8') as version_file:
version = version_file.read().strip()
# List of files to update with version information
files_to_update = [
'setting_manager_ui/json_settings.py',
'setting_manager_ui/setting_ui.py'
]
for file_path in files_to_update:
updateVersionInFile(file_path, version)
if __name__ == '__main__':
main()