Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions scripts/release_autoversioning.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

import configparser

def update_version_in_files(gnoll_ini_path, setup_cfg_path, project_toml_path):
# Read version from GNOLL.ini
config = configparser.ConfigParser()
config.read(gnoll_ini_path)
version = config['Meta Information']['version']

# Update version in setup.cfg
with open(setup_cfg_path, 'r') as f:
lines = f.readlines()

with open(setup_cfg_path, 'w') as f:
for line in lines:
if line.startswith('version ='):
f.write(f'version = {version}\n')
else:
f.write(line)

# Update version in Project.toml
with open(project_toml_path, 'r') as f:
Comment thread
ianfhunter marked this conversation as resolved.
Outdated
lines = f.readlines()

with open(project_toml_path, 'w') as f:
Comment thread
ianfhunter marked this conversation as resolved.
Outdated
for line in lines:
if line.startswith('version ='):
f.write(f'version = "{version}"\n')
else:
f.write(line)

gnoll_ini_path = 'GNOLL.ini'
setup_cfg_path = 'src/python/setup.cfg'
project_toml_path = 'GNOLL/src/julia/GNOLL/Project.toml'
update_version_in_files(gnoll_ini_path, setup_cfg_path, project_toml_path)