Files
VirtualChemistry/version_upgrade.py
2024-06-23 04:33:03 +08:00

16 lines
486 B
Python

import requests
import re
r = requests.get('http://127.0.0.1:3000/api/packages/hzhang/nuget/query')
res = r.text
d = eval(res)
version = ""
for x in d['data']:
if x['id'] == 'VirtualChemistry':
version = x['version']
w = version.split('.')
w[-1] = str(int(w[-1]) + 1)
version = '.'.join(w)
w = open("VirtualChemistry.csproj", "r").read()
h = re.sub(r'<Version>.*</Version>', r'<Version>'+version+'</Version>',w)
with open("VirtualChemistry.csproj", "w") as f:
f.write(h)