-
-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathupdate_version.py
35 lines (29 loc) · 1.27 KB
/
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
35
#######################################################################
# Copyright (c) 2019-present, Blosc Development Team <[email protected]>
# All rights reserved.
#
# This source code is licensed under a BSD-style license (found in the
# LICENSE file in the root directory of this source tree)
#######################################################################
import re
import sys
def update_version(new_version):
# Update version in pyproject.toml
with open("pyproject.toml") as file:
pyproject_content = file.read()
pyproject_content = re.sub(r'version = ".*"', f'version = "{new_version}"', pyproject_content)
with open("pyproject.toml", "w") as file:
file.write(pyproject_content)
# Update version in src/blosc2/version.py
with open("src/blosc2/version.py") as file:
version_content = file.read()
version_content = re.sub(r'__version__ = ".*"', f'__version__ = "{new_version}"', version_content)
with open("src/blosc2/version.py", "w") as file:
file.write(version_content)
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python update_version.py <new_version>")
sys.exit(1)
new_version = sys.argv[1]
update_version(new_version)
print(f"Version updated to {new_version}")