Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
leonfoks committed Oct 10, 2024
1 parent ec8b376 commit ae62542
Showing 1 changed file with 36 additions and 9 deletions.
45 changes: 36 additions & 9 deletions update_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,39 @@
Parser.add_argument('version', help='version')
args = Parser.parse_args()

with open("setup.py", "r") as f:
lines = f.readlines()

with open("setup.py", "w") as f:
for line in lines:
if "__version__ =" in line:
f.write("__version__ = '{}'\n".format(args.version))
else:
f.write(line)
with open("documentation_source/source/conf.py", "r") as f:
lines = f.readlines()
with open("documentation_source/source/conf.py", "w") as f:
for line in lines:
if "version =" in line:
f.write('version = "{}"\n'.format(args.version))
elif "release =" in line:
f.write('release = "{}"\n'.format(args.version))
else:
f.write(line)

try:
with open("setup.py", "r") as f:
lines = f.readlines()

with open("setup.py", "w") as f:
for line in lines:
if "__version__ =" in line:
f.write('__version__ = "{}"\n'.format(args.version))
else:
f.write(line)
except:
pass

try:
with open("pyproject.toml", "r") as f:
lines = f.readlines()

with open("pyproject.toml", "w") as f:
for line in lines:
if "version =" in line:
f.write('version = "{}"\n'.format(args.version))
else:
f.write(line)
except:
pass

0 comments on commit ae62542

Please sign in to comment.