ClashX.Meta/ClashX/goClash/upgrade_core.py

29 lines
716 B
Python
Raw Normal View History

2019-10-13 21:08:14 +08:00
import subprocess
import os
import re
from build_clash import get_full_version
2019-10-13 21:08:14 +08:00
from build_clash import build_clash
def upgrade_version(current_version):
string = open('go.mod').read()
2022-06-12 12:04:57 +08:00
# string = string.replace(current_version, "dev")
2019-10-13 21:08:14 +08:00
file = open("go.mod", "w")
file.write(string)
def install():
subprocess.check_output("go mod download", shell=True)
subprocess.check_output("go mod tidy", shell=True)
if __name__ == '__main__':
print("start")
current = get_full_version()
2019-10-13 21:08:14 +08:00
print("current version:", current)
upgrade_version(current)
install()
new_version = get_full_version()
2019-10-13 21:08:14 +08:00
print("new version:", new_version, ",start building")
build_clash(new_version)