Skip to content

Commit 65b2987

Browse files
committed
Add set-wslwrapper-version.py script
Signed-off-by: Vitalii Koshura <[email protected]>
1 parent 34f9721 commit 65b2987

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This file is part of BOINC.
2+
# https://boinc.berkeley.edu
3+
# Copyright (C) 2025 University of California
4+
#
5+
# BOINC is free software; you can redistribute it and/or modify it
6+
# under the terms of the GNU Lesser General Public License
7+
# as published by the Free Software Foundation,
8+
# either version 3 of the License, or (at your option) any later version.
9+
#
10+
# BOINC is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
# See the GNU Lesser General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU Lesser General Public License
16+
# along with BOINC. If not, see <http://www.gnu.org/licenses/>.
17+
18+
import sys
19+
20+
def set_version_h(version):
21+
with open('version.h', 'r') as f:
22+
lines = f.readlines()
23+
with open('version.h', 'w') as f:
24+
for line in lines:
25+
if line.startswith('#define WSL_WRAPPER_RELEASE'):
26+
line = f'#define WSL_WRAPPER_RELEASE {version}\n'
27+
f.write(line)
28+
29+
def set_vcxproj(version):
30+
for vcxproj in ['win_build/wsl_wrapper.vcxproj']:
31+
with open(vcxproj, 'r') as f:
32+
lines = f.readlines()
33+
with open(vcxproj, 'w') as f:
34+
for line in lines:
35+
if line.startswith(' <TargetVersion>'):
36+
line = f' <TargetVersion>{version}</TargetVersion>\n'
37+
f.write(line)
38+
39+
if (len(sys.argv) != 2):
40+
print('Usage: set-wslwrapper-version.py VERSION')
41+
exit(1)
42+
43+
version = sys.argv[1]
44+
45+
print(f'Setting wsl_wrapper version to {version}...')
46+
47+
set_version_h(version)
48+
set_vcxproj(version)
49+
50+
print('Done.')

0 commit comments

Comments
 (0)