Files
VirtualChemistry.Test/nuget_update.py
2024-06-23 05:03:15 +08:00

20 lines
656 B
Python

import requests
r = requests.get('http://127.0.0.1:3000/api/packages/hzhang/nuget/query')
res = r.text
d = eval(res)
skVersion = ""
vcVersion = ""
for x in d['data']:
if x['id'] == 'VirtualChemistry':
vcVersion = x['version']
if x['id'] == 'Skeleton':
skVersion = x['version']
w = open('VirtualChemistryTest.csproj', 'r').read()
s = w.split('<ItemGroup>')
s[1] = '\n<PackageReference Include="VirtualChemistry" Version="'+vcVersion+'"/>\n' + s[1]
s[1] = '\n<PackageReference Include="Skeleton" Version="'+skVersion+'"/>\n' + s[1]
w = '<ItemGroup>'.join(s)
print(w)
with open('VirtualChemistryTest.csproj', 'w') as f:
f.write(w)