File indexing completed on 2026-04-09 07:58:23
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 import io
0013 import re
0014 import sys
0015
0016 new_version = sys.argv[1]
0017
0018
0019 ver_files = ['main/lib/idds/core/version.py',
0020 'atlas/lib/idds/atlas/version.py',
0021 'common/lib/idds/common/version.py',
0022 'workflow/lib/idds/workflow/version.py',
0023 'client/lib/idds/client/version.py',
0024 'doma/lib/idds/doma/version.py',
0025 'website/lib/idds/website/version.py',
0026 'monitor/lib/idds/monitor/version.py',
0027 'prompt/lib/idds/prompt/version.py']
0028
0029
0030 env_files = ['atlas/tools/atlas/env/environment.yml',
0031 'common/tools/common/env/environment.yml',
0032 'main/tools/env/environment.yml',
0033 'client/tools/client/env/environment.yml',
0034 'doma/tools/doma/env/environment.yml',
0035 'workflow/tools/workflow/env/environment.yml',
0036 'prompt/tools/prompt/env/environment.yml']
0037
0038
0039 pyproject_files = [
0040 'main/pyproject.toml',
0041 'atlas/pyproject.toml',
0042 'common/pyproject.toml',
0043 'workflow/pyproject.toml',
0044 'client/pyproject.toml',
0045 'doma/pyproject.toml',
0046 'website/pyproject.toml',
0047 'monitor/pyproject.toml',
0048 'prompt/pyproject.toml',
0049 ]
0050
0051
0052 for ver_file in ver_files:
0053 print(ver_file)
0054 with io.open(ver_file, "rt", encoding="utf8") as f:
0055 version = re.search(r'release_version = "(.*?)"', f.read()).group(1)
0056
0057 with io.open(ver_file, "rt", encoding="utf8") as f:
0058 data = f.read()
0059
0060 data = data.replace(version, new_version)
0061 with io.open(ver_file, "wt", encoding="utf8") as f:
0062 f.write(data)
0063
0064 for env_file in env_files:
0065 print(env_file)
0066
0067 data = None
0068 with io.open(env_file, "rt", encoding="utf8") as f:
0069 for line in f:
0070 stripline = line.strip()
0071 if stripline.startswith('- idds-'):
0072 pkg, ver = line.split("==")
0073 line = pkg + '==' + new_version + "\n"
0074 if data is None:
0075 data = line
0076 else:
0077 data = data + line
0078
0079 if data.endswith('\n'):
0080 data = data[:-1]
0081
0082 with io.open(env_file, "wt", encoding="utf8") as f:
0083 f.write(data)
0084
0085 for pyproject_file in pyproject_files:
0086 print(pyproject_file)
0087 with io.open(pyproject_file, "rt", encoding="utf8") as f:
0088 data = f.read()
0089
0090
0091 def _repl(m):
0092 return f"{m.group(1)}{new_version}{m.group(3)}"
0093
0094 data = re.sub(r'(version\s*=\s*")([^"]+)(")', _repl, data)
0095 with io.open(pyproject_file, "wt", encoding="utf8") as f:
0096 f.write(data)