2024-08-07 22:00:27 +08:00
|
|
|
|
import os, sys, re, json
|
2024-04-27 19:56:54 +08:00
|
|
|
|
import shutil, json
|
2024-05-09 16:58:24 +08:00
|
|
|
|
import subprocess, time
|
2024-05-01 17:40:57 +08:00
|
|
|
|
import urllib.request
|
2024-08-07 22:09:20 +08:00
|
|
|
|
from urllib.parse import urljoin
|
2024-04-26 23:13:46 +08:00
|
|
|
|
|
2024-08-07 22:18:52 +08:00
|
|
|
|
rootDir = os.path.dirname(__file__)
|
|
|
|
|
if sys.argv[1] == "loadversion":
|
|
|
|
|
os.chdir(rootDir)
|
|
|
|
|
with open("plugins/CMakeLists.txt", "r", encoding="utf8") as ff:
|
|
|
|
|
pattern = r"set\(VERSION_MAJOR\s*(\d+)\s*\)\nset\(VERSION_MINOR\s*(\d+)\s*\)\nset\(VERSION_PATCH\s*(\d+)\s*\)"
|
|
|
|
|
match = re.findall(pattern, ff.read())[0]
|
|
|
|
|
version_major, version_minor, version_patch = match
|
|
|
|
|
versionstring = f"v{version_major}.{version_minor}.{version_patch}"
|
|
|
|
|
print("version=" + versionstring)
|
|
|
|
|
exit()
|
2024-08-07 04:29:08 +08:00
|
|
|
|
# 继github被封后,域名又被封了。真是走了狗屎运了。这个世界上到底还有什么是能信任的。
|
|
|
|
|
# 暂时先这样吧。在软件内使用重定向链接,因为链接失效没办法及时更新;在github网站或文档内,用直链。
|
2024-08-07 22:00:27 +08:00
|
|
|
|
with open(
|
|
|
|
|
"LunaTranslator/files/defaultconfig/static_data.json", "r", encoding="utf8"
|
|
|
|
|
) as ff:
|
|
|
|
|
data = json.loads(ff.read())
|
|
|
|
|
hostservers = data["main_server"]
|
2024-08-07 22:06:13 +08:00
|
|
|
|
print(hostservers)
|
2024-08-07 22:00:27 +08:00
|
|
|
|
hostserver = None
|
|
|
|
|
|
|
|
|
|
for _hostserver in hostservers:
|
|
|
|
|
try:
|
|
|
|
|
urllib.request.urlopen(_hostserver)
|
|
|
|
|
hostserver = _hostserver
|
|
|
|
|
break
|
|
|
|
|
except:
|
|
|
|
|
pass
|
2024-08-07 22:06:13 +08:00
|
|
|
|
print(hostserver)
|
2024-08-07 04:29:08 +08:00
|
|
|
|
links302 = {
|
|
|
|
|
"Github": {
|
|
|
|
|
"LunaTranslator": "HIllya51/LunaTranslator",
|
|
|
|
|
"LunaHook": "HIllya51/LunaHook",
|
|
|
|
|
},
|
|
|
|
|
"Resource": {
|
|
|
|
|
"ocr_models": {
|
|
|
|
|
"ja.zip": "https://github.com/test123456654321/RESOURCES/releases/download/ocr_models/ja.zip",
|
|
|
|
|
},
|
|
|
|
|
"build_req": {
|
|
|
|
|
"mecab.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/mecab.zip",
|
|
|
|
|
"ocr.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/ocr.zip",
|
|
|
|
|
"magpie.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/magpie.zip",
|
|
|
|
|
"stylesheets-main.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/stylesheets-main.zip",
|
|
|
|
|
"zstd.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/zstd.zip",
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-08-07 22:06:13 +08:00
|
|
|
|
def _dynalink(path: str):
|
2024-08-07 22:00:27 +08:00
|
|
|
|
if hostserver:
|
2024-08-07 22:09:20 +08:00
|
|
|
|
return urljoin(hostserver, path)
|
2024-08-07 04:29:08 +08:00
|
|
|
|
pathx = path.split("/")
|
|
|
|
|
if pathx[0] == "Github":
|
|
|
|
|
return (
|
|
|
|
|
"https://github.com/"
|
|
|
|
|
+ links302.get(pathx[0]).get(pathx[1])
|
|
|
|
|
+ "/"
|
|
|
|
|
+ "/".join(pathx[2:])
|
|
|
|
|
)
|
|
|
|
|
return links302.get(pathx[0]).get(pathx[1]).get(pathx[2])
|
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
2024-08-07 22:06:13 +08:00
|
|
|
|
def dynalink(path):
|
|
|
|
|
_ = _dynalink(path)
|
|
|
|
|
print(_)
|
|
|
|
|
return _
|
|
|
|
|
|
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
pluginDirs = ["DLL32", "DLL64", "Locale_Remulator", "LunaHook", "Magpie", "NTLEAS"]
|
|
|
|
|
|
|
|
|
|
vcltlFile = "https://github.com/Chuyu-Team/VC-LTL5/releases/download/v5.0.9/VC-LTL-5.0.9-Binary.7z"
|
|
|
|
|
vcltlFileName = "VC-LTL-5.0.9-Binary.7z"
|
|
|
|
|
brotliFile32 = "https://github.com/google/brotli/releases/latest/download/brotli-x86-windows-dynamic.zip"
|
|
|
|
|
brotliFileName32 = "brotli-x86-windows-dynamic.zip"
|
|
|
|
|
brotliFile64 = "https://github.com/google/brotli/releases/latest/download/brotli-x64-windows-dynamic.zip"
|
|
|
|
|
brotliFileName64 = "brotli-x64-windows-dynamic.zip"
|
|
|
|
|
localeEmulatorFile = "https://github.com/xupefei/Locale-Emulator/releases/download/v2.5.0.1/Locale.Emulator.2.5.0.1.zip"
|
|
|
|
|
localeEmulatorFileName = "Locale.Emulator.2.5.0.1.zip"
|
|
|
|
|
ntleaFile = "https://github.com/zxyacb/ntlea/releases/download/0.46/ntleas046_x64.7z"
|
|
|
|
|
ntleaFileName = "ntleas046_x64.7z"
|
2024-07-17 03:00:09 +08:00
|
|
|
|
curlFile32 = "https://curl.se/windows/dl-8.8.0_3/curl-8.8.0_3-win32-mingw.zip"
|
|
|
|
|
curlFileName32 = "curl-8.8.0_3-win32-mingw.zip"
|
|
|
|
|
curlFile64 = "https://curl.se/windows/dl-8.8.0_3/curl-8.8.0_3-win64-mingw.zip"
|
|
|
|
|
curlFileName64 = "curl-8.8.0_3-win64-mingw.zip"
|
2024-04-26 12:20:29 +08:00
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
2024-08-07 04:29:08 +08:00
|
|
|
|
ocrModelUrl = dynalink("Resource/ocr_models/ja.zip")
|
2024-04-26 05:49:49 +08:00
|
|
|
|
availableLocales = ["cht", "en", "ja", "ko", "ru", "zh"]
|
|
|
|
|
|
2024-08-07 04:29:08 +08:00
|
|
|
|
LunaHook_latest = dynalink(
|
|
|
|
|
"Github/LunaHook/releases/latest/download/Release_English.zip"
|
|
|
|
|
)
|
2024-07-01 02:21:03 +08:00
|
|
|
|
|
|
|
|
|
LocaleRe = "https://github.com/InWILL/Locale_Remulator/releases/download/v1.5.3-beta.1/Locale_Remulator.1.5.3-beta.1.zip"
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def createPluginDirs():
|
|
|
|
|
os.chdir(rootDir + "\\LunaTranslator\\files")
|
|
|
|
|
if not os.path.exists("plugins"):
|
|
|
|
|
os.mkdir("plugins")
|
|
|
|
|
os.chdir("plugins")
|
|
|
|
|
for pluginDir in pluginDirs:
|
|
|
|
|
if not os.path.exists(pluginDir):
|
|
|
|
|
os.mkdir(pluginDir)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def installVCLTL():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {vcltlFile}")
|
|
|
|
|
subprocess.run(f"7z x {vcltlFileName} -oVC-LTL5")
|
|
|
|
|
os.chdir("VC-LTL5")
|
|
|
|
|
subprocess.run("cmd /c Install.cmd")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def downloadBrotli():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {brotliFile32}")
|
|
|
|
|
subprocess.run(f"curl -LO {brotliFile64}")
|
|
|
|
|
subprocess.run(f"7z x {brotliFileName32} -obrotli32")
|
|
|
|
|
subprocess.run(f"7z x {brotliFileName64} -obrotli64")
|
|
|
|
|
shutil.move(
|
|
|
|
|
"brotli32/brotlicommon.dll", f"{rootDir}/LunaTranslator/files/plugins/DLL32"
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"brotli32/brotlidec.dll", f"{rootDir}/LunaTranslator/files/plugins/DLL32"
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"brotli64/brotlicommon.dll", f"{rootDir}/LunaTranslator/files/plugins/DLL64"
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"brotli64/brotlidec.dll", f"{rootDir}/LunaTranslator/files/plugins/DLL64"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2024-05-03 19:44:40 +08:00
|
|
|
|
def downloadlr():
|
|
|
|
|
|
2024-07-01 02:21:03 +08:00
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {LocaleRe}")
|
|
|
|
|
subprocess.run(f"7z x {LocaleRe.split('/')[-1]} -oLR")
|
|
|
|
|
os.makedirs(
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/Locale_Remulator",
|
|
|
|
|
exist_ok=True,
|
|
|
|
|
)
|
|
|
|
|
for _dir, _, _fs in os.walk("LR"):
|
|
|
|
|
for f in _fs:
|
|
|
|
|
if f in ["LRHookx64.dll", "LRHookx32.dll"]:
|
|
|
|
|
shutil.move(
|
|
|
|
|
os.path.join(_dir, f),
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/Locale_Remulator",
|
|
|
|
|
)
|
2024-05-03 19:44:40 +08:00
|
|
|
|
|
|
|
|
|
|
2024-05-29 02:09:31 +08:00
|
|
|
|
def move_directory_contents(source_dir, destination_dir):
|
|
|
|
|
contents = os.listdir(source_dir)
|
|
|
|
|
|
|
|
|
|
for item in contents:
|
|
|
|
|
if item == ".git":
|
|
|
|
|
continue
|
|
|
|
|
item_path = os.path.join(source_dir, item)
|
|
|
|
|
try:
|
|
|
|
|
shutil.move(item_path, destination_dir)
|
|
|
|
|
except:
|
|
|
|
|
for k in os.listdir(item_path):
|
|
|
|
|
shutil.move(
|
|
|
|
|
os.path.join(item_path, k), os.path.join(destination_dir, item)
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2024-04-26 05:53:33 +08:00
|
|
|
|
def downloadcommon():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
2024-05-03 19:44:40 +08:00
|
|
|
|
downloadlr()
|
2024-08-07 04:29:08 +08:00
|
|
|
|
subprocess.run(f"curl -LO {dynalink('Resource/build_req/mecab.zip')}")
|
2024-04-26 23:13:46 +08:00
|
|
|
|
subprocess.run(f"7z x mecab.zip -oALL")
|
2024-08-07 04:29:08 +08:00
|
|
|
|
subprocess.run(f"curl -LO {dynalink('Resource/build_req/ocr.zip')}")
|
2024-04-26 23:13:46 +08:00
|
|
|
|
subprocess.run(f"7z x ocr.zip -oALL")
|
2024-08-07 04:29:08 +08:00
|
|
|
|
subprocess.run(f"curl -LO {dynalink('Resource/build_req/magpie.zip')}")
|
2024-04-26 23:13:46 +08:00
|
|
|
|
subprocess.run(f"7z x magpie.zip -oALL")
|
|
|
|
|
|
|
|
|
|
move_directory_contents("ALL/ALL", f"{rootDir}/LunaTranslator/files/plugins")
|
2024-04-26 07:28:56 +08:00
|
|
|
|
|
2024-04-26 05:53:33 +08:00
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
def downloadLocaleEmulator():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {localeEmulatorFile}")
|
|
|
|
|
subprocess.run(f"7z x {localeEmulatorFileName} -oLocaleEmulator")
|
|
|
|
|
shutil.move(
|
|
|
|
|
"LocaleEmulator/LoaderDll.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/LoaderDll.dll",
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"LocaleEmulator/LocaleEmulator.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/LocaleEmulator.dll",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def downloadNtlea():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {ntleaFile}")
|
|
|
|
|
subprocess.run(f"7z x {ntleaFileName} -ontlea")
|
|
|
|
|
shutil.move(
|
|
|
|
|
"ntlea/x86/ntleai.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/NTLEAS/ntleai.dll",
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"ntlea/x64/ntleak.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/NTLEAS/ntleak.dll",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def downloadCurl():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {curlFile32}")
|
|
|
|
|
subprocess.run(f"curl -LO {curlFile64}")
|
|
|
|
|
subprocess.run(f"7z x {curlFileName32}")
|
|
|
|
|
subprocess.run(f"7z x {curlFileName64}")
|
|
|
|
|
outputDirName32 = curlFileName32.replace(".zip", "")
|
|
|
|
|
shutil.move(
|
|
|
|
|
f"{outputDirName32}/bin/libcurl.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/DLL32",
|
|
|
|
|
)
|
|
|
|
|
outputDirName64 = curlFileName64.replace(".zip", "")
|
|
|
|
|
shutil.move(
|
|
|
|
|
f"{outputDirName64}/bin/libcurl-x64.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/DLL64",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2024-08-07 04:29:08 +08:00
|
|
|
|
def downloadOCRModel():
|
2024-04-26 05:49:49 +08:00
|
|
|
|
os.chdir(rootDir + "\\LunaTranslator\\files")
|
|
|
|
|
if not os.path.exists("ocr"):
|
|
|
|
|
os.mkdir("ocr")
|
|
|
|
|
os.chdir("ocr")
|
2024-08-07 04:29:08 +08:00
|
|
|
|
subprocess.run(f"curl -LO {ocrModelUrl}")
|
|
|
|
|
subprocess.run(f"7z x ja.zip")
|
|
|
|
|
os.remove(f"ja.zip")
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
|
|
|
|
|
2024-05-01 17:40:57 +08:00
|
|
|
|
def get_url_as_json(url):
|
2024-05-09 16:58:24 +08:00
|
|
|
|
for i in range(10):
|
|
|
|
|
try:
|
|
|
|
|
response = urllib.request.urlopen(url)
|
|
|
|
|
data = response.read().decode("utf-8")
|
|
|
|
|
json_data = json.loads(data)
|
|
|
|
|
return json_data
|
|
|
|
|
except:
|
|
|
|
|
time.sleep(3)
|
|
|
|
|
|
2024-05-01 17:40:57 +08:00
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
def buildLunaHook():
|
2024-07-01 02:21:03 +08:00
|
|
|
|
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO {LunaHook_latest}")
|
|
|
|
|
subprocess.run(f"7z x {LunaHook_latest.split('/')[-1]}")
|
|
|
|
|
shutil.move(
|
|
|
|
|
"Release_English/LunaHook32.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/LunaHook",
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"Release_English/LunaHost32.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/LunaHook",
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"Release_English/LunaHook64.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/LunaHook",
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"Release_English/LunaHost64.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/LunaHook",
|
|
|
|
|
)
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
2024-04-26 23:13:46 +08:00
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
def buildPlugins():
|
|
|
|
|
os.chdir(rootDir + "\\plugins\\scripts")
|
2024-06-05 04:00:10 +08:00
|
|
|
|
subprocess.run("python fetchwebview2.py")
|
|
|
|
|
subprocess.run(
|
|
|
|
|
f'cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A win32 -T host=x86 -B ../build/x86 -DCMAKE_SYSTEM_VERSION=10.0.26621.0'
|
|
|
|
|
)
|
|
|
|
|
subprocess.run(
|
|
|
|
|
f"cmake --build ../build/x86 --config Release --target ALL_BUILD -j 14"
|
|
|
|
|
)
|
|
|
|
|
subprocess.run(f"python copytarget.py 1")
|
|
|
|
|
subprocess.run(
|
|
|
|
|
f'cmake ../CMakeLists.txt -G "Visual Studio 17 2022" -A x64 -T host=x64 -B ../build/x64 -DCMAKE_SYSTEM_VERSION=10.0.26621.0'
|
|
|
|
|
)
|
|
|
|
|
subprocess.run(
|
|
|
|
|
f"cmake --build ../build/x64 --config Release --target ALL_BUILD -j 14"
|
|
|
|
|
)
|
|
|
|
|
subprocess.run(f"python copytarget.py 0")
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
2024-05-29 02:09:31 +08:00
|
|
|
|
|
2024-05-28 00:26:26 +08:00
|
|
|
|
def downloadsomething():
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
2024-08-07 04:29:08 +08:00
|
|
|
|
subprocess.run(f"curl -LO {dynalink('Resource/build_req/stylesheets-main.zip')}")
|
2024-07-08 01:42:49 +08:00
|
|
|
|
subprocess.run(f"7z x stylesheets-main.zip -oALL")
|
2024-08-10 20:17:15 +08:00
|
|
|
|
shutil.move(
|
|
|
|
|
"ALL/bass.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/DLL32",
|
|
|
|
|
)
|
|
|
|
|
shutil.move(
|
|
|
|
|
"ALL/x64/bass.dll",
|
|
|
|
|
f"{rootDir}/LunaTranslator/files/plugins/DLL64",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def downloadbass():
|
|
|
|
|
|
|
|
|
|
os.chdir(rootDir + "\\temp")
|
|
|
|
|
subprocess.run(f"curl -LO https://www.un4seen.com/files/bass24.zip")
|
|
|
|
|
subprocess.run(f"7z x bass24.zip -oALL")
|
2024-08-07 04:29:08 +08:00
|
|
|
|
move_directory_contents(
|
|
|
|
|
"ALL/stylesheets-main", rootDir + "\\LunaTranslator\\files\\themes"
|
|
|
|
|
)
|
2024-05-29 02:09:31 +08:00
|
|
|
|
|
|
|
|
|
|
2024-04-26 05:49:49 +08:00
|
|
|
|
if __name__ == "__main__":
|
2024-04-26 23:13:46 +08:00
|
|
|
|
arch = sys.argv[1]
|
2024-06-25 03:21:56 +08:00
|
|
|
|
version = sys.argv[2]
|
2024-04-26 05:49:49 +08:00
|
|
|
|
os.chdir(rootDir)
|
2024-05-29 02:09:31 +08:00
|
|
|
|
os.system("git submodule update --init --recursive")
|
2024-04-26 23:13:46 +08:00
|
|
|
|
os.makedirs("temp", exist_ok=True)
|
2024-04-26 05:49:49 +08:00
|
|
|
|
|
2024-04-26 23:13:46 +08:00
|
|
|
|
createPluginDirs()
|
2024-05-28 00:26:26 +08:00
|
|
|
|
downloadsomething()
|
2024-04-27 19:00:12 +08:00
|
|
|
|
downloadBrotli()
|
|
|
|
|
downloadLocaleEmulator()
|
|
|
|
|
downloadNtlea()
|
|
|
|
|
downloadCurl()
|
2024-08-07 04:29:08 +08:00
|
|
|
|
downloadOCRModel()
|
2024-04-27 19:00:12 +08:00
|
|
|
|
downloadcommon()
|
2024-08-10 20:17:15 +08:00
|
|
|
|
downloadbass()
|
2024-04-27 19:00:12 +08:00
|
|
|
|
buildLunaHook()
|
|
|
|
|
|
|
|
|
|
installVCLTL()
|
|
|
|
|
buildPlugins()
|
|
|
|
|
|
|
|
|
|
os.chdir(rootDir)
|
2024-04-26 23:13:46 +08:00
|
|
|
|
|
|
|
|
|
if arch == "x86":
|
2024-06-25 03:21:56 +08:00
|
|
|
|
py37Path = f"C:\\hostedtoolcache\\windows\\Python\\{version}\\x86\\python.exe"
|
2024-04-27 19:00:12 +08:00
|
|
|
|
else:
|
2024-06-25 03:21:56 +08:00
|
|
|
|
py37Path = f"C:\\hostedtoolcache\\windows\\Python\\{version}\\x64\\python.exe"
|
2024-04-27 19:00:12 +08:00
|
|
|
|
|
|
|
|
|
os.chdir(rootDir + "\\LunaTranslator")
|
|
|
|
|
|
|
|
|
|
subprocess.run(f"{py37Path} -m pip install --upgrade pip")
|
|
|
|
|
subprocess.run(f"{py37Path} -m pip install -r requirements.txt")
|
2024-06-25 13:19:19 +08:00
|
|
|
|
# 3.8之后会莫名其妙引用这个b东西,然后这个b东西会把一堆没用的东西导入进来
|
|
|
|
|
shutil.rmtree(os.path.join(os.path.dirname(py37Path), "Lib\\test"))
|
2024-06-25 16:26:21 +08:00
|
|
|
|
shutil.rmtree(os.path.join(os.path.dirname(py37Path), "Lib\\unittest"))
|
2024-06-25 17:53:01 +08:00
|
|
|
|
# 放弃,3.8需要安装KB2533623才能运行,3.7用不着。
|
2024-06-25 03:21:56 +08:00
|
|
|
|
subprocess.run(f"{py37Path} retrieval.py")
|