forked from xioTechnologies/x-IMU3-Software
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.py
39 lines (26 loc) · 1.11 KB
/
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
35
36
37
38
39
import os
import re
version = "1.5.1"
def replace(file_path, string):
with open(file_path) as file:
lines = file.readlines()
with open(file_path, "w") as file:
for line in lines:
file.write(re.sub(string, string.replace("\\", "").replace(".*", version), line))
for root, _, files in os.walk(os.path.dirname(os.path.realpath(__file__))):
for file in files:
file_path = os.path.join(root, file)
if file == "Cargo.toml":
replace(file_path, 'version = ".*"\n')
if file == "pyproject.toml":
replace(file_path, 'version = ".*"')
if file == "CMakeLists.txt":
replace(file_path, "project\\(x-IMU3-Software VERSION .*\\)")
if file == "AssemblyInfo.cpp":
replace(file_path, 'AssemblyVersionAttribute\\(".*"\\)')
if file == "AssemblyInfo.cs":
replace(file_path, 'AssemblyVersion\\(".*"\\)')
if file == "AssemblyInfo.cs":
replace(file_path, 'AssemblyFileVersion\\(".*"\\)')
if file == "WindowsInstaller.iss":
replace(file_path, "AppVersion=.*\n")