|
| 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_configure_ac(version): |
| 21 | + with open('configure.ac', 'r') as f: |
| 22 | + lines = f.readlines() |
| 23 | + with open('configure.ac', 'w') as f: |
| 24 | + for line in lines: |
| 25 | + if line.startswith('DOCKERWRAPPER_RELEASE='): |
| 26 | + line = f'DOCKERWRAPPER_RELEASE={version}\n' |
| 27 | + f.write(line) |
| 28 | + |
| 29 | +def set_version_h(version): |
| 30 | + with open('version.h', 'r') as f: |
| 31 | + lines = f.readlines() |
| 32 | + with open('version.h', 'w') as f: |
| 33 | + for line in lines: |
| 34 | + if line.startswith('#define DOCKERWRAPPER_RELEASE'): |
| 35 | + line = f'#define DOCKERWRAPPER_RELEASE {version}\n' |
| 36 | + f.write(line) |
| 37 | + |
| 38 | +def set_vcxproj(version): |
| 39 | + for vcxproj in ['win_build/docker_wrapper.vcxproj']: |
| 40 | + with open(vcxproj, 'r') as f: |
| 41 | + lines = f.readlines() |
| 42 | + with open(vcxproj, 'w') as f: |
| 43 | + for line in lines: |
| 44 | + if line.startswith(' <TargetVersion>'): |
| 45 | + line = f' <TargetVersion>{version}</TargetVersion>\n' |
| 46 | + f.write(line) |
| 47 | + |
| 48 | +if (len(sys.argv) != 2): |
| 49 | + print('Usage: set-dockerwrapper-version.py VERSION') |
| 50 | + exit(1) |
| 51 | + |
| 52 | +version = sys.argv[1] |
| 53 | + |
| 54 | +print(f'Setting dockerwrapper version to {version}...') |
| 55 | + |
| 56 | +set_configure_ac(version) |
| 57 | +set_version_h(version) |
| 58 | +set_vcxproj(version) |
| 59 | + |
| 60 | +print('Done.') |
0 commit comments