diff --git a/AllInstall.py b/AllInstall.py index 3748f37..ad61ad8 100755 --- a/AllInstall.py +++ b/AllInstall.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 # 使用系统默认的 python3 运行 ########################################################################################### -# 作者:gfdgd xi -# 版本:1.5.1 -# 更新时间:2022年07月03日 +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 -# 基于 Python3 的 tkinter 构建 +# 基于 Python3 构建 ########################################################################################### ################# # 引入所需的库 @@ -26,8 +26,16 @@ def InstallSparkWine(wine): #os.system("sudo apt install apt-fast -y") #os.system(f"sudo ss-apt-fast install \"{wine}\" -y") #return - os.system("sudo ss-apt-fast update") - os.system(f"sudo ss-apt-fast install \"{wine}\" -y") + #os.system("sudo ss-apt-fast update") + if not os.system("which aptss"): + os.system(f"sudo aptss install \"{wine}\" -y") + elif not os.system("which ss-apt-fast"): + os.system("sudo ss-apt-fast update") + os.system(f"sudo ss-apt-fast install \"{wine}\" -y") + elif not os.system("which apt-fast"): + os.system(f"sudo apt-fast install \"{wine}\" -y") + else: + os.system(f"sudo apt install \"{wine}\" -y") ################### # 程序功能 diff --git a/AutoConfig.py b/AutoConfig.py index 815fd91..395e42d 100644 --- a/AutoConfig.py +++ b/AutoConfig.py @@ -1,117 +1,80 @@ +#!/usr/bin/env python3 import os -import PyQt5.QtCore as QtCore -shell = """# “#”后面代表注释 -# 可以为了方便观看改为 bash 的高亮模式 -# 安装 dll -installdll 0 -installdll 1 -# 安装字体 -installfont 0 # 后面参数填 Wine 运行器的字体安装器提示的编号 -# 安装字体(安装星火应用商店的微软核心字体) -installsparkcorefont -# 安装 Mono -installmono -# 安装 gecko -installgecko -# 安装 vcpp -installvcpp 0 # 后面参数填 Wine 运行器的 VCPP 安装器提示的编号 -# 安装 .net -installnet # 后面参数填 Wine 运行器的 VCPP 安装器提示的编号 -# 安装 MSXML -installmsxml # 后面参数填 Wine 运行器的 MSXML 安装器提示的编号 -#aaaaa -""" +import sys +import json +import traceback +import requests +import PyQt5.QtWidgets as QtWidgets +from UI.AutoConfig import * -class Command(): - # 可以被使用的命令 - commandList = [ - "installdll", - "installfont", - "installsparkcorefont", - "installmono", - "installgecko", - "installvcpp", - "installnet", - "installmsxml" - ] - def __init__(self, commandString: str) -> None: - self.commandString = commandString +urlSources = "https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/auto" +lists = [] - # 解析器 - # 命令字符串转可供解析的列表 - def GetCommandList(self) -> list: - shellList = [] - shellFirstShell = self.commandString.split("\n") - # 转换成可以执行的数组 - for l in range(0, len(shellFirstShell)): - i = shellFirstShell[l] - # 判断有没有注释 - if "#" in i: - # 忽略注释 - i = i[:i.index("#")] - # 删除前后空格 - i = i.strip() - # 如果是空行 - if i == "": - # 忽略此行,此行不做处理 - continue - # 解析 - i = i.split() - # 判断是否为合法的参数,否则提示并忽略 - if not i[0] in self.commandList: - print(f"行{l + 1}命令{i[0]}不存在,忽略") - continue - shellList.append(i) - return shellList +class Connect: + def SearchBotton_Clicked(): + nmodel = QtGui.QStandardItemModel(window) + if ui.searchThings.text() == "": + # 显示全部内容 + for i in lists: + nmodel.appendRow(QtGui.QStandardItem(i[0])) + ui.searchList.setModel(nmodel) + return + for i in lists: + # 显示筛选的内容 + if ui.searchThings.text() in i[0]: + nmodel.appendRow(QtGui.QStandardItem(i[0])) + ui.searchList.setModel(nmodel) - # 运行器 - class Run(): - programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string - def InstallDll(self) -> int: - import InstallDll - return InstallDll.Download(self.wineBottonPath, InstallDll.GetNameByNumber(int(self.command[1])), InstallDll.GetUrlByNumber(int(self.command[1]))) - - def InstallFont(self) -> int: - pass - - def InstallMono(self) -> int: - return os.system(f"ENTERNOTSHOW=0 '{self.programPath}/InstallMono.py' '{self.wineBottonPath}' '{self.wine}' mono") - - def InstallGecko(self) -> int: - return os.system(f"ENTERNOTSHOW=0 '{self.programPath}/InstallMono.py' '{self.wineBottonPath}' '{self.wine}' gecko") - - def InstallVCPP(self) -> int: - pass - - def InstallNet(self) -> int: - pass - - def InstallMsxml(self) -> int: - pass - - def InstallSparkCoreFont(self): - pass - - # 可以运行的命令的映射关系 - # 可以被使用的命令的映射 - commandList = { - "installdll": InstallDll, - "installfont": InstallFont, - "installsparkcorefont": InstallSparkCoreFont, - "installmono": InstallMono, - "installgecko": InstallGecko, - "installvcpp": InstallVCPP, - "installnet": InstallNet, - "installmsxml": InstallMsxml - } - # 解析 - def __init__(self, command: list, wineBottonPath: str, wine: str) -> int: - self.wineBottonPath = wineBottonPath - self.wine = wine - for i in command: - self.command = i - self.commandList[i[0]](self) + def RunBotton_Clicked(): + # 获取选中项 + try: + choose = ui.searchList.selectionModel().selectedIndexes()[0].data() + except: + QtWidgets.QMessageBox.critical(window, "错误", "您未选择任何配置文件") + return + fileName = "" + for i in lists: + print(i) + if i[0] == choose: + fileName = i[1] + break + # 下载脚本 + try: + print(f"{urlSources}/{fileName}") + file = open("/tmp/wine-runner-auto-config.wsh", "w") + file.write(requests.get(f"{urlSources}/{fileName}").text) + file.close() + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(window, "错误", "无法获取配置文件") + return + # 执行脚本 + process = QtCore.QProcess() + process.start(f"{programPath}/launch.sh", ["deepin-terminal", "-e", "env", "WINE=deepin-wine6-stable", "WINEPREFIX=/home/gfdgd_xi/.deepinwine", f"{programPath}/ConfigLanguareRunner.py", "/tmp/wine-runner-auto-config.wsh"]) + process.waitForFinished() -com = Command(shell) -com.Run(com.GetCommandList(), "/home/gfdgd_xi/.wine", "deepin-wine6-stable") \ No newline at end of file + +if __name__ == "__main__": + programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + app = QtWidgets.QApplication(sys.argv) + window = QtWidgets.QMainWindow() + ui = Ui_MainWindow() + ui.setupUi(window) + window.show() + # 连接信号和槽 + ui.saerchBotton.clicked.connect(Connect.SearchBotton_Clicked) + ui.runBotton.clicked.connect(Connect.RunBotton_Clicked) + # 解析云列表 + try: + # 获取列表 + lists = json.loads(requests.get(f"{urlSources}/list.json").text) + # 解释列表并显示在 GUI 上 + nmodel = QtGui.QStandardItemModel(window) + for i in lists: + nmodel.appendRow(QtGui.QStandardItem(i[0])) + ui.searchList.setModel(nmodel) + except: + traceback.print_exc() + QtWidgets.QMessageBox.critical(window, "提示", "无法连接服务器") + app.exec_() \ No newline at end of file diff --git a/ConfigLanguareRunner.py b/ConfigLanguareRunner.py new file mode 100755 index 0000000..5d60248 --- /dev/null +++ b/ConfigLanguareRunner.py @@ -0,0 +1,361 @@ +#!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:2.1.0 +# 更新时间:2022年08月25日 +# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 +# 基于 Python3 构建 +########################################################################################### +from inspect import trace +import os +import sys +import time +import json +import traceback +import PyQt5.QtWidgets as QtWidgets +# 读取文本文档 +def readtxt(path): + f = open(path, "r") # 设置文件对象 + str = f.read() # 获取内容 + f.close() # 关闭文本对象 + return str # 返回结果 + +programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string +information = json.loads(readtxt(f"{programPath}/information.json")) +version = information["Version"] +thankText = "" +for i in information["Thank"]: + thankText += f"{i}\n" +programEnv = [ + ["($WINEPREFIX)", f"{os.path.expanduser('~')}/.wine"], + ["($WINE)", "deepin-wine6-stable"], + ["($DANGER)", "0"], + ["($HOME)", os.path.expanduser('~')], + ["($PROGRAMPATH)", programPath], + ["($VERSION)", version], + ["($THANK)", thankText], + ["($MAKER)", "gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["($COPYRIGHT)", f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢"], + ["($?)", 0] +] +readOnlyEnv = [ + "($DANGER)", + "($HOME)", + "($PROGRAMPATH)", + "($VERSION)", + "($THANK)" +] + +class Command(): + # 有风险的命令 + dangerCommand = [ + "bash", + "bat", + "download" + ] + # 可以被使用的命令 + commandList = [ + "installdll", + "installfont", + "installsparkcorefont", + "installmono", + "installgecko", + "installvcpp", + "installnet", + "installmsxml", + "echo", + "info", + "error", + "warning", + "exit", + "bash", + "bat", + "version", + "thank", + "pause", + "download" + ] + + def __init__(self, commandString: str) -> None: + self.commandString = commandString + + # 解析器 + # 命令字符串转可供解析的列表 + def GetCommandList(self) -> list: + shellList = [] + shellFirstShell = self.commandString.split("\n") + # 转换成可以执行的数组 + for l in range(0, len(shellFirstShell)): + i = shellFirstShell[l] + # 判断有没有注释 + if "#" in i: + # 忽略注释 + i = i[:i.index("#")] + # 删除前后空格 + i = i.strip() + # 如果是空行 + if i == "": + # 忽略此行,此行不做处理 + continue + # 空格转义 + i = i.replace("\\ ", "@Space@") + # 解析 + i = i.split() + # 判断是否为合法的参数,否则提示并忽略 + if not i[0] in self.commandList and i[0][0] != "(": + print(f"行{l + 1}命令{i[0]}不存在,忽略") + programEnv[9][1] = "-2" + continue + if programEnv[2][1] == "0" and i[0] in self.dangerCommand: + print(f"行{l + 1}命令{i[0]}目前解析器不允许运行,忽略") + print("如果需要运行,可以在配置面板开启“允许修改系统”选项(针对GUI用户)") + print("或添加参数 --system(终端调用运行用户)") + programEnv[9][1] = "-1" + continue + rightList = [] + for k in i: + # 处理符号转义 + rightList.append(k.replace("@Space@", " ").replace("\\n", "\n").replace("\\r", "\r")) + shellList.append(rightList) + return shellList + + # 运行器 + class Run(): + close = False + programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string + def Exit(self): + self.close = True + return 0 + + def InstallDll(self) -> int: + import InstallDll + # 如果是数字 + number = False + try: + int(self.command[1]) + number = True + except: + pass + if number: + return InstallDll.Download(self.wineBottonPath, InstallDll.GetNameByNumber(int(self.command[1])), InstallDll.GetUrlByNumber(int(self.command[1]))) + return InstallDll.Download(self.wineBottonPath, self.command[1], InstallDll.GetUrlByName(self.command[1])) + + def Thank(self) -> int: + for i in information["Thank"]: + print(i) + return 0 + + def InstallFont(self) -> int: + import InstallFont + return InstallFont.Download(self.wineBottonPath, int(self.command[1])) + + def InstallMono(self) -> int: + return os.system(f"ENTERNOTSHOW=0 '{self.programPath}/InstallMono.py' '{self.wineBottonPath}' '{self.wine}' mono") + + def InstallGecko(self) -> int: + return os.system(f"ENTERNOTSHOW=0 '{self.programPath}/InstallMono.py' '{self.wineBottonPath}' '{self.wine}' gecko") + + def InstallVCPP(self) -> int: + import InstallVisualCPlusPlus + return InstallVisualCPlusPlus.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def InstallNet(self) -> int: + import InstallNetFramework + return InstallNetFramework.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def InstallMsxml(self) -> int: + import InstallMsxml + return InstallMsxml.Download(self.wineBottonPath, int(self.command[1]), self.wine) + + def Info(self) -> int: + QtWidgets.QMessageBox.information(None, self.command[1], self.command[2]) + return 0 + + def InstallSparkCoreFont(self): + if not os.system("which aptss"): + # 最新版本星火应用商店处理 + os.system("pkexec bash aptss ssupdate") + return os.system("pkexec bash aptss install ms-core-fonts") + if not os.system("which ss-apt-fast"): + # 稍久的版本 + os.system("pkexec ss-apt-fast update") + return os.system("pkexec bash ss-apt-fast install ms-core-fonts") + # 不知道什么版本的处理方法 + if not os.system("which apt-fast"): + # 稍久的版本 + os.system("pkexec apt-fast update") + return os.system("pkexec apt-fast install ms-core-fonts") + os.system("pkexec apt update") + return os.system("pkexec apt install ms-core-fonts") + + def Echo(self) -> int: + del self.command[0] + print(" ".join(self.command)) + return 0 + + def Warning(self): + QtWidgets.QMessageBox.warning(None, self.command[1], self.command[2]) + return 0 + + def Error(self): + QtWidgets.QMessageBox.critical(None, self.command[1], self.command[2]) + return 0 + + def Bash(self): + command = "" + for i in self.command[1:]: + command += f"'{i}' " + return os.system(command) + + def Bat(self): + command = ["WINEPREFIX='$WINEPREFIX'", "$WINE"] + for i in programEnv: + for k in range(len(command)): + command[k] = command[k].replace(i[0], i[1]) + for i in self.command[1:]: + command.append(i) + commandStr = command[0] + " " + for i in command[1:]: + commandStr += f"{i} " + print(commandStr) + return os.system(commandStr) + + def Version(self): + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") + return 0 + + def Pause(self) -> int: + input("按回车键继续……") + return 0 + + def Download(self) -> int: + command = f"aria2c -x 16 -s 16 -c '{self.command[1]}' " + try: + command += f"-d '{self.command[2]}' " + command += f"-o '{self.command[3]}' " + except: + pass + return os.system(command) + + # 可以运行的命令的映射关系 + # 可以被使用的命令的映射 + commandList = { + "installdll": InstallDll, + "installfont": InstallFont, + "installsparkcorefont": InstallSparkCoreFont, + "installmono": InstallMono, + "installgecko": InstallGecko, + "installvcpp": InstallVCPP, + "installnet": InstallNet, + "installmsxml": InstallMsxml, + "echo": Echo, + "info": Info, + "warning": Warning, + "error": Error, + "exit": Exit, + "bash": Bash, + "bat": Bat, + "version": Version, + "thank": Thank, + "pause": Pause, + "download": Download + } + + # 参数数列表 + commandInfo = { + "installdll": [1], + "installfont": [1], + "installsparkcorefont": [0], + "installmono": [0], + "installgecko": [0], + "installvcpp": [1], + "installnet": [1], + "installmsxml": [1], + "echo": [1], + "info": [2], + "warning": [2], + "error": [2], + "exit": [0], + "bash": [1], + "bat": [1], + "version": [0], + "thank": [0], + "pause": [0], + "download": [1] + } + + # 解析 + def __init__(self, command: list, wineBottonPath: str, wine: str) -> int: + self.wineBottonPath = wineBottonPath + self.wine = wine + for i in command: + self.command = i + # 变量解析 + if self.command[0][0] == "(" and "=" in self.command[0]: + env = i[0][: i[0].index("=")] + value = i[0][i[0].index("=") + 1:] + # 判断是不是只读变量 + if env in readOnlyEnv: + print(f"运行命令{' '.join(self.command)}出现错误") + print(f"变量 {env} 只读,无法修改,忽略") + continue + change = False + for k in range(len(programEnv)): + # 修改变量 + if env == programEnv[k][0]: + programEnv[k][1] = value + change = True + break + if not change: + # 添加变量 + programEnv.append([f"{env}", value]) + continue + # 正常命令解析 + if len(i) -1 < self.commandInfo[i[0]][0]: + print("参数不足") + continue + # 替换环境变量 + for a in range(1, len(i)): + for b in programEnv: + if b[0] in i[a]: + i[a] = i[a].replace(b[0], b[1]) + commandReturn = self.commandList[i[0]](self) + if commandReturn: + print(f"运行命令{' '.join(self.command)}出现错误") + programEnv[9][1] = str(commandReturn) + if self.close: + break + +if __name__ == "__main__": + app = QtWidgets.QApplication(sys.argv) + optionAll = 0 + if "--system" in sys.argv: + programEnv[2][1] = "1" + optionAll += 1 + if os.getenv("WINE") != None: + programEnv[1][1] = os.getenv("WINE") + if os.getenv("WINEPREFIX") != None: + programEnv[0][1] = os.getenv("WINEPREFIX") + if len(sys.argv) - optionAll < 2: + print("Wine 运行器自动配置文件解析器交互环境") + print(f"版本:{version}") + print(f"©2020~{time.strftime('%Y')} gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("--------------------------------------------------------------") + while True: + commandLine = input(">") + if commandLine == "exit": + break + com = Command(commandLine) + com.Run(com.GetCommandList(), programEnv[0][1], programEnv[1][1]) + exit() + # 读取文件 + try: + file = open(sys.argv[1], "r") + com = Command(file.read()) + file.close() + except: + print("错误:无法读取该文件,无法继续") + sys.exit(1) + com.Run(com.GetCommandList(), programEnv[0][1], programEnv[1][1]) \ No newline at end of file diff --git a/InstallDll.py b/InstallDll.py index d7d346b..869f13d 100755 --- a/InstallDll.py +++ b/InstallDll.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月24日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -32,12 +32,17 @@ def GetUrlByNumber(dllID: int) -> str: def GetNameByNumber(dllID: int) -> str: return lists[dllID][0] +def GetUrlByName(dllName: str): + for i in range(0, len(lists)): + if dllName == lists[i][0]: + return f"{url}/{lists[i][1]}/{lists[i][2]}/{lists[i][0]}" + def Download(wineBotton, dllName, urlPart) -> bool: try: os.remove(f"{wineBotton}/drive_c/windows/system32/{dllName}") except: pass - return not os.system(f"aria2c -x 16 -s 16 -d '{wineBotton}/drive_c/windows/system32' -o '{dllName}' '{urlPart}'") + return os.system(f"aria2c -x 16 -s 16 -d '{wineBotton}/drive_c/windows/system32' -o '{dllName}' '{urlPart}'") def exit(): input("按回车键退出") diff --git a/InstallFont.py b/InstallFont.py index a5e13bc..bb94430 100755 --- a/InstallFont.py +++ b/InstallFont.py @@ -1,9 +1,34 @@ #!/usr/bin/env python3 +# 使用系统默认的 python3 运行 +########################################################################################### +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:2.1.0 +# 更新时间:2022年08月25日 +# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 +# 基于 Python3 构建 +########################################################################################### +################# +# 引入所需的库 +################# import os import sys import json import shutil import requests +homePath = os.path.expanduser('~') +try: + fontList = json.loads(requests.get("https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/fonts/list.json").text) +except: + fontList = [ + ["fake_simsun.ttc", "https://gitlink.org.cn/api/attachments/392168", "simsun.ttc", "fake_simsun.ttc(会替换容器内的宋体,且与 deepin 有问题)"], + ["simsun.ttc", "https://gitlink.org.cn/api/attachments/392181", "simsun.ttc", "simsun.ttc"], + ["simsunb.ttf", "https://gitlink.org.cn/api/attachments/392180", "simsunb.ttf", "simsunb.ttf"], + ["msyh.ttc", "https://gitlink.org.cn/api/attachments/392182", "msyh.ttc", "msyh.ttc"], + ["msyhl.ttc", "https://gitlink.org.cn/api/attachments/392184", "msyhl.ttc", "msyhl.ttc"], + ["msyhbd.ttc", "https://gitlink.org.cn/api/attachments/392183", "msyhbd.ttc", "msyhbd.ttc"] +] +def Download(wineBotton: str, id: int) -> int: + return os.system(f"aria2c -x 16 -s 16 -d '{wineBotton}/drive_c/windows/Fonts/{fontList[id][2]}' -o '{fontList[id][0]}' \"{fontList[id][1]}\"") if __name__ == "__main__": if "--help" in sys.argv: @@ -17,8 +42,6 @@ if __name__ == "__main__": print("XXX 参数一") print("参数一为需要安装的容器") sys.exit() - - homePath = os.path.expanduser('~') while True: os.system("clear") print(''' @@ -33,17 +56,7 @@ if __name__ == "__main__": if not os.path.exists(f"{sys.argv[1]}/drive_c/windows/Fonts"): input("您选择的不是 Wine 容器,无法继续,按回车键退出") exit() - try: - fontList = json.loads(requests.get("https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/fonts/list.json").text) - except: - fontList = [ - ["fake_simsun.ttc", "https://gitlink.org.cn/api/attachments/392168", "simsun.ttc", "fake_simsun.ttc(会替换容器内的宋体,且与 deepin 有问题)"], - ["simsun.ttc", "https://gitlink.org.cn/api/attachments/392181", "simsun.ttc", "simsun.ttc"], - ["simsunb.ttf", "https://gitlink.org.cn/api/attachments/392180", "simsunb.ttf", "simsunb.ttf"], - ["msyh.ttc", "https://gitlink.org.cn/api/attachments/392182", "msyh.ttc", "msyh.ttc"], - ["msyhl.ttc", "https://gitlink.org.cn/api/attachments/392184", "msyhl.ttc", "msyhl.ttc"], - ["msyhbd.ttc", "https://gitlink.org.cn/api/attachments/392183", "msyhbd.ttc", "msyhbd.ttc"] - ] + for i in range(0, len(fontList)): print(f"{i} {fontList[i][3]}") while True: diff --git a/InstallMono.py b/InstallMono.py index da62561..fd9feb7 100755 --- a/InstallMono.py +++ b/InstallMono.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月06日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -65,7 +65,7 @@ except: file = open(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/information.txt", "r") version = file.read().replace("\n", "") print("安装版本:", version) - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") if exitInputShow: input("安装结束,按回车键退出") exit() @@ -98,7 +98,7 @@ if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.m print("缓存版本:", version.replace("/", "")) print("已经缓存,使用本地版本") file.close() - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") if exitInputShow: input("安装结束,按回车键退出") exit() @@ -109,7 +109,7 @@ os.system(f"rm -rf \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install. os.system("mkdir -p /tmp/winegeckomonoinstall") os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}\" -o install.msi \"{programDownloadUrl}\"") print("开始安装") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") +os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i \"{homePath}/.cache/deepin-wine-runner/{sys.argv[3]}/install.msi\"") try: if sys.argv[4] == "1": print("写入缓存") diff --git a/InstallMsxml.py b/InstallMsxml.py index c983afa..49998d1 100755 --- a/InstallMsxml.py +++ b/InstallMsxml.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月06日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -14,29 +14,6 @@ import os import sys import json import requests - -if "--help" in sys.argv: - print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") - print("版本:1.0.0") - print("本程序可以更方便的在 wine 容器中安装 MSXML") - sys.exit() -if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": - print("您未指定需要安装 MSXML 的容器和使用的 wine,无法继续") - print("参数:") - print("XXX 参数一 参数二 参数三(可略)") - print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") - sys.exit() - -homePath = os.path.expanduser('~') -print(''' - m m mmmm m m m m m - ## ## #" " # # ## ## # - # ## # "#mmm ## # ## # # - # "" # "# m""m # "" # # - # # "mmm#" m" "m # # #mmmmm - - -''') try: msxmlList = json.loads(requests.get("https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/msxml/list.json").text) except: @@ -45,39 +22,68 @@ except: ["MSXML 4.0 SP3", "https://www.gitlink.org.cn/api/attachments/390678?gfdgd_xi", "msxml4.0SP3.msi"], ["MSXML 6.0", "https://www.gitlink.org.cn/api/attachments/390681?gfdgd_xi", "msxml6_x64.msi"] ] -print("请选择以下的 MSXML 进行安装(不保证能正常安装运行)") -for i in range(0, len(msxmlList)): - print(f"{i}、{msxmlList[i][0]}") -while True: - try: - choose = input("请输入要选择要安装的 MSXML(输入“exit”退出):") - if choose.lower() == "exit": + +def Download(wineBotton: str, id: int, wine: str): + os.system(f"aria2c -x 16 -s 16 -d \"/tmp/deepin-wine-runner-msxml/\" -o \"{msxmlList[id][2]}\" \"{msxmlList[id][1]}\"") + os.system(f"WINEPREFIX='{wineBotton}' '{wine}' msiexec /i \"/tmp/deepin-wine-runner-msxml/{msxmlList[id][2]}\"") + +if __name__ == "__main__": + if "--help" in sys.argv: + print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("版本:1.0.0") + print("本程序可以更方便的在 wine 容器中安装 MSXML") + sys.exit() + if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": + print("您未指定需要安装 MSXML 的容器和使用的 wine,无法继续") + print("参数:") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") + sys.exit() + + homePath = os.path.expanduser('~') + print(''' + m m mmmm m m m m m + ## ## #" " # # ## ## # + # ## # "#mmm ## # ## # # + # "" # "# m""m # "" # # + # # "mmm#" m" "m # # #mmmmm + + +''') + + print("请选择以下的 MSXML 进行安装(不保证能正常安装运行)") + for i in range(0, len(msxmlList)): + print(f"{i}、{msxmlList[i][0]}") + while True: + try: + choose = input("请输入要选择要安装的 MSXML(输入“exit”退出):") + if choose.lower() == "exit": + break + choose = int(choose) + except: + print("输入错误,请重新输入") + continue + if 0 <= choose and choose < len(msxmlList): break - choose = int(choose) + try: + if choose.lower() == "exit": + exit() except: - print("输入错误,请重新输入") - continue - if 0 <= choose and choose < len(msxmlList): - break -try: - if choose.lower() == "exit": + pass + print(f"您选择了 {msxmlList[choose][0]}") + if len(sys.argv) <= 3: + choice = True + else: + choice = (sys.argv[3] == "1") + if os.path.exists(f"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}") and choice: + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") + input("安装结束,按回车键退出") exit() -except: - pass -print(f"您选择了 {msxmlList[choose][0]}") -if len(sys.argv) <= 3: - choice = True -else: - choice = (sys.argv[3] == "1") -if os.path.exists(f"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}") and choice: - print("已经缓存,使用本地版本") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") - input("安装结束,按回车键退出") - exit() -print("开始下载") -os.system(f"rm -rfv \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") -os.system(f"mkdir -p \"{homePath}/.config/deepin-wine-runner/MSXML/\"") -os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.config/deepin-wine-runner/MSXML\" -o \"{msxmlList[choose][2]}\" \"{msxmlList[choose][1]}\"") -print("开始安装") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") -input("安装结束,按回车键退出") \ No newline at end of file + print("开始下载") + os.system(f"rm -rfv \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") + os.system(f"mkdir -p \"{homePath}/.config/deepin-wine-runner/MSXML/\"") + os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.config/deepin-wine-runner/MSXML\" -o \"{msxmlList[choose][2]}\" \"{msxmlList[choose][1]}\"") + print("开始安装") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i \"{homePath}/.config/deepin-wine-runner/MSXML/{msxmlList[choose][2]}\"") + input("安装结束,按回车键退出") \ No newline at end of file diff --git a/InstallNetFramework.py b/InstallNetFramework.py index c841039..8a29b65 100755 --- a/InstallNetFramework.py +++ b/InstallNetFramework.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月01日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -14,29 +14,6 @@ import os import sys import json import requests - -if "--help" in sys.argv: - print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") - print("版本:1.0.0") - print("本程序可以更方便的在 wine 容器中安装 .net framework") - sys.exit() -if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": - print("您未指定需要安装 .net framework 的容器和使用的 wine,无法继续") - print("参数:") - print("XXX 参数一 参数二 参数三(可略)") - print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") - sys.exit() - -homePath = os.path.expanduser('~') -print(''' - mm m mmmmmmmmmmmmm - #"m # # # - # #m # #mmmmm # - # # # # # - # # ## #mmmmm # - - -''') try: netList = json.loads(requests.get("https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/net/list.json").text) except: @@ -54,40 +31,69 @@ except: ["4.7.2 Offline Installer", "https://download.visualstudio.microsoft.com/download/pr/1f5af042-d0e4-4002-9c59-9ba66bcf15f6/089f837de42708daacaae7c04b7494db/ndp472-kb4054530-x86-x64-allos-enu.exe"], ["4.8 Offline Installer", "https://download.visualstudio.microsoft.com/download/pr/2d6bb6b2-226a-4baa-bdec-798822606ff1/8494001c276a4b96804cde7829c04d7f/ndp48-x86-x64-allos-enu.exe"] ] -print("请选择以下的 .net framework 进行安装(不保证能正常安装运行)") -for i in range(0, len(netList)): - print(f"{i} .net framework {netList[i][0]}") -while True: - try: - choose = input("请输入要选择的 .net framework 版本(输入“exit”退出):").lower() - if choose == "exit": - break - choose = int(choose) - except: - print("输入错误,请重新输入") - continue - if 0 <= choose and choose < len(netList): - break -if choose == "exit": - exit() -if len(sys.argv) <= 3: - choice = True -else: - choice = (sys.argv[3] == "1") -print(f"您选择了 .net framework {netList[choose][0]}") -print(f"如果是 Offline Installer 版本,提示需要连接互联网,其实是不需要的,断网也可以安装") -print(f"如果 Offline Installer 版本连接网络时安装失败,提示无法连接服务器或连接超时,可以尝试下载完安装包加载过程中断网以便断网安装") -print(f"一般建议 Offline Installer 版本在下载完 exe 安装程序后在加载过程中断网以便提高安装速度") -programName = os.path.split(netList[choose][1])[1] -if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/.netframework/{programName}") and choice: - print("已经缓存,使用本地版本") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") - input("安装结束,按回车键退出") - exit() -print("开始下载") -os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") -os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/.netframework'") -os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/.netframework\" -o \"{programName}\" \"{netList[choose][1]}\"") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") -input("安装结束,按回车键退出") \ No newline at end of file +def Download(wineBotton: str, id: int, wine: str): + programName = os.path.split(netList[id][1])[1] + os.system(f"aria2c -x 16 -s 16 -d \"/tmp/deepin-wine-runner-net\" -o \"{programName}\" \"{netList[id][1]}\"") + os.system(f"WINEPREFIX='{wineBotton}' '{wine}' '/tmp/deepin-wine-runner-net/{programName}'") + +if __name__ == "__main__": + if "--help" in sys.argv: + print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("版本:1.0.0") + print("本程序可以更方便的在 wine 容器中安装 .net framework") + sys.exit() + if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": + print("您未指定需要安装 .net framework 的容器和使用的 wine,无法继续") + print("参数:") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") + sys.exit() + + homePath = os.path.expanduser('~') + print(''' + mm m mmmmmmmmmmmmm + #"m # # # + # #m # #mmmmm # + # # # # # + # # ## #mmmmm # + + +''') + print("请选择以下的 .net framework 进行安装(不保证能正常安装运行)") + for i in range(0, len(netList)): + print(f"{i} .net framework {netList[i][0]}") + while True: + try: + choose = input("请输入要选择的 .net framework 版本(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) + except: + print("输入错误,请重新输入") + continue + if 0 <= choose and choose < len(netList): + break + + if choose == "exit": + exit() + if len(sys.argv) <= 3: + choice = True + else: + choice = (sys.argv[3] == "1") + print(f"您选择了 .net framework {netList[choose][0]}") + print(f"如果是 Offline Installer 版本,提示需要连接互联网,其实是不需要的,断网也可以安装") + print(f"如果 Offline Installer 版本连接网络时安装失败,提示无法连接服务器或连接超时,可以尝试下载完安装包加载过程中断网以便断网安装") + print(f"一般建议 Offline Installer 版本在下载完 exe 安装程序后在加载过程中断网以便提高安装速度") + programName = os.path.split(netList[choose][1])[1] + if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/.netframework/{programName}") and choice: + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") + input("安装结束,按回车键退出") + exit() + print("开始下载") + os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") + os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/.netframework'") + os.system(f"aria2c -x 16 -s 16 -d \"{homePath}/.cache/deepin-wine-runner/.netframework\" -o \"{programName}\" \"{netList[choose][1]}\"") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' '{homePath}/.cache/deepin-wine-runner/.netframework/{programName}'") + input("安装结束,按回车键退出") \ No newline at end of file diff --git a/InstallNewWineHQ.sh b/InstallNewWineHQ.sh index 8347126..7c2a986 100755 --- a/InstallNewWineHQ.sh +++ b/InstallNewWineHQ.sh @@ -1,4 +1,15 @@ #!/bin/bash +# 使用系统默认的 bash 运行 +########################################################################################### +# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 +# 版本:2.1.0 +# 更新时间:2022年08月25日 +# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 +# 基于 Python3 构建 +########################################################################################### +################# +# 引入所需的库 +################# echo echo 'm m " m m mmmm ' echo '# # # mmm m mm mmm # # m" "m' @@ -60,6 +71,10 @@ which ss-apt-fast > /dev/null if [ $? == 0 ]; then apt="ss-apt-fast" fi +which aptss > /dev/null +if [ $? == 0 ]; then + apt="aptss" +fi # 添加源 if [ $system = "0" ]; then ${debianSource[$systemVersion]} diff --git a/InstallOther.py b/InstallOther.py index e6586ff..79840f2 100755 --- a/InstallOther.py +++ b/InstallOther.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月01日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -66,11 +66,11 @@ print(f"您选择了{msxmlList[choose][0]}") if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}") and choice: print("已经缓存,使用本地版本") if msxmlList[choose][2] == "msi": - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") input("安装结束,按回车键退出") sys.exit() if msxmlList[choose][2] == "exe": - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") input("安装结束,按回车键退出") sys.exit() print("开始下载") @@ -79,12 +79,12 @@ os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/other'") if msxmlList[choose][2] == "msi": os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/other' -o '{msxmlList[choose][3]}' \"{msxmlList[choose][1]}\"") print("开始安装") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' msiexec /i '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") print("安装结束") sys.exit() if msxmlList[choose][2] == "exe": os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/other' -o '{msxmlList[choose][3]}' \"{msxmlList[choose][1]}\"") print("开始安装") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' '{homePath}/.cache/deepin-wine-runner/other/{msxmlList[choose][3]}'") input("安装结束,按回车键退出") sys.exit() \ No newline at end of file diff --git a/InstallVisualCPlusPlus.py b/InstallVisualCPlusPlus.py index 826d2ff..ace14b6 100755 --- a/InstallVisualCPlusPlus.py +++ b/InstallVisualCPlusPlus.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月01日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### @@ -14,21 +14,46 @@ import os import sys import json import requests +try: + netList = json.loads(requests.get("https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/vscpp/list.json").text) +except: + netList = [ + ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE", "vcredist05_x86.exe"], + ["2008 (VC++ 9.0) SP1 (不再支持) X86", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe", "vcredist08_x86.exe"], + ["2008 (VC++ 9.0) SP1 (不再支持) X64", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x64.exe", "vcredist08_x86.exe"], + ["2010 (VC++ 10.0) SP1 (不再支持) X86", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe", "vcredist10_x86.exe"], + ["2010 (VC++ 10.0) SP1 (不再支持) X64", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe", "vcredist10_x64.exe"], + ["2012 (VC++ 11.0) Update 4 X86", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe", "vcredist12_x86.exe"], + ["2012 (VC++ 11.0) Update 4 X64", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x64.exe", "vcredist12_x64.exe"], + ["2013 (VC++ 12.0) X86", "https://aka.ms/highdpimfc2013x86enu", "vcredist13_x86.exe"], + ["2013 (VC++ 12.0) X64", "https://aka.ms/highdpimfc2013x64enu", "vcredist13_x64.exe"], + ["2015、2017、2019 和 2022 X86", "https://aka.ms/vs/17/release/vc_redist.x86.exe", "vc_redist15.x86.exe"], + ["2015、2017、2019 和 2022 X64", "https://aka.ms/vs/17/release/vc_redist.x64.exe", "vc_redist15.x64.exe"], + ["2015、2017、2019 和 2022 ARM64", "https://aka.ms/vs/17/release/vc_redist.arm64.exe", "vc_redist15.arm64.exe"] + ] +def Download(wineBotton: str, id: int, wine: str) -> int: + try: + os.remove(f"/tmp/deepin-wine-runner-vcpp/{netList[id][2]}") + except: + pass + os.system(f"aria2c -x 16 -s 16 -d '/tmp/deepin-wine-runner-vcpp' -o '{netList[id][2]}' \"{netList[id][1]}\"") + os.system(f"WINEPREFIX='{wineBotton}' '{wine}' '/tmp/deepin-wine-runner-vcpp/{netList[id][2]}'") -if "--help" in sys.argv: - print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") - print("版本:1.0.0") - print("本程序可以更方便的在 wine 容器中安装 Visual Studio C++") - sys.exit() -if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": - print("您未指定需要安装 Visual Studio C++ 的容器和使用的 wine,无法继续") - print("参数:") - print("XXX 参数一 参数二 参数三(可略)") - print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") - sys.exit() +if __name__ == "__main__": + if "--help" in sys.argv: + print("作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢") + print("版本:1.0.0") + print("本程序可以更方便的在 wine 容器中安装 Visual Studio C++") + sys.exit() + if len(sys.argv) <= 2 or sys.argv[1] == "" or sys.argv[2] == "": + print("您未指定需要安装 Visual Studio C++ 的容器和使用的 wine,无法继续") + print("参数:") + print("XXX 参数一 参数二 参数三(可略)") + print("参数一为需要安装的容器,参数二为需要使用的wine,参数三为是否缓存(可略),三个参数位置不能颠倒") + sys.exit() -homePath = os.path.expanduser('~') -print(''' + homePath = os.path.expanduser('~') + print(''' m m mmm "m m" m" " m m # # # # # @@ -37,42 +62,32 @@ print(''' ''') -try: - netList = json.loads(requests.get("https://code.gitlink.org.cn/gfdgd_xi/wine-runner-list/raw/branch/master/vscpp/list.json").text) -except: - netList = [ - ["2005 Service Pack 1 Redistributable Package MFC 安全更新", "https://download.microsoft.com/download/4/A/2/4A22001F-FA3B-4C13-BF4E-42EC249D51C4/vcredist_x86.EXE", "vcredist05_x86.exe"], - ["2008 (VC++ 9.0) SP1 (不再支持) ", "https://download.microsoft.com/download/5/D/8/5D8C65CB-C849-4025-8E95-C3966CAFD8AE/vcredist_x86.exe", "vcredist08_x86.exe"], - ["2010 (VC++ 10.0) SP1 (不再支持) ", "https://download.microsoft.com/download/1/6/5/165255E7-1014-4D0A-B094-B6A430A6BFFC/vcredist_x86.exe", "vcredist10_x86.exe"], - ["2012 (VC++ 11.0) Update 4", "https://download.microsoft.com/download/1/6/B/16B06F60-3B20-4FF2-B699-5E9B7962F9AE/VSU_4/vcredist_x86.exe", "vcredist12_x86.exe"], - ["2013 (VC++ 12.0) ", "https://download.visualstudio.microsoft.com/download/pr/10912113/5da66ddebb0ad32ebd4b922fd82e8e25/vcredist_x86.exe", "vcredist13_x86.exe"], - ["2015、2017、2019 和 2022", "https://aka.ms/vs/17/release/vc_redist.x86.exe", "vcredist15_x86.exe"] - ] -print("请选择以下的 Visual Studio C++ 进行安装(不保证能正常安装运行)") -for i in range(0, len(netList)): - print(f"{i} Visual Studio C++ {netList[i][0]}") -while True: - try: - choose = input("请输入要选择的 Visual Studio C++ 版本(输入“exit”退出):").lower() - if choose == "exit": + + print("请选择以下的 Visual Studio C++ 进行安装(不保证能正常安装运行)") + for i in range(0, len(netList)): + print(f"{i} Visual Studio C++ {netList[i][0]}") + while True: + try: + choose = input("请输入要选择的 Visual Studio C++ 版本(输入“exit”退出):").lower() + if choose == "exit": + break + choose = int(choose) + except: + print("输入错误,请重新输入") + continue + if 0 <= choose and choose < len(netList): break - choose = int(choose) - except: - print("输入错误,请重新输入") - continue - if 0 <= choose and choose < len(netList): - break -if choose == "exit": - exit() -print(f"您选择了 Visual Studio C++ {netList[choose][0]}") -if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}"): - print("已经缓存,使用本地版本") - os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") - input("安装结束,按回车键退出") - exit() -print("开始下载") -os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") -os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/vcpp'") -os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/vcpp' -o '{netList[choose][2]}' \"{netList[choose][1]}\"") -os.system(f"WINEPREFIX={sys.argv[1]} {sys.argv[2]} '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") -input("安装结束,按回车键退出") \ No newline at end of file + if choose == "exit": + exit() + print(f"您选择了 Visual Studio C++ {netList[choose][0]}") + if os.path.exists(f"{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}"): + print("已经缓存,使用本地版本") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") + input("安装结束,按回车键退出") + exit() + print("开始下载") + os.system(f"rm -rf '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") + os.system(f"mkdir -p '{homePath}/.cache/deepin-wine-runner/vcpp'") + os.system(f"aria2c -x 16 -s 16 -d '{homePath}/.cache/deepin-wine-runner/vcpp' -o '{netList[choose][2]}' \"{netList[choose][1]}\"") + os.system(f"WINEPREFIX='{sys.argv[1]}' '{sys.argv[2]}' '{homePath}/.cache/deepin-wine-runner/vcpp/{netList[choose][2]}'") + input("安装结束,按回车键退出") \ No newline at end of file diff --git a/InstallWineOnDeepin23.py b/InstallWineOnDeepin23.py index 2f81807..fb77be1 100755 --- a/InstallWineOnDeepin23.py +++ b/InstallWineOnDeepin23.py @@ -2,8 +2,8 @@ # 使用系统默认的 python3 运行 ########################################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢 -# 版本:1.8.0 -# 更新时间:2022年08月02日 +# 版本:2.1.0 +# 更新时间:2022年08月25日 # 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 构建 ########################################################################################### diff --git a/UI/AutoConfig.py b/UI/AutoConfig.py new file mode 100644 index 0000000..dc727d2 --- /dev/null +++ b/UI/AutoConfig.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'AutoConfig.ui' +# +# Created by: PyQt5 UI code generator 5.15.6 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_MainWindow(object): + def setupUi(self, MainWindow): + MainWindow.setObjectName("MainWindow") + MainWindow.resize(800, 600) + self.centralwidget = QtWidgets.QWidget(MainWindow) + self.centralwidget.setObjectName("centralwidget") + self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.centralwidget) + self.verticalLayout_3.setObjectName("verticalLayout_3") + self.horizontalLayout = QtWidgets.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.searchTips = QtWidgets.QLabel(self.centralwidget) + self.searchTips.setObjectName("searchTips") + self.horizontalLayout.addWidget(self.searchTips) + self.searchThings = QtWidgets.QLineEdit(self.centralwidget) + self.searchThings.setObjectName("searchThings") + self.horizontalLayout.addWidget(self.searchThings) + self.saerchBotton = QtWidgets.QPushButton(self.centralwidget) + self.saerchBotton.setObjectName("saerchBotton") + self.horizontalLayout.addWidget(self.saerchBotton) + self.verticalLayout_3.addLayout(self.horizontalLayout) + self.searchList = QtWidgets.QListView(self.centralwidget) + self.searchList.setObjectName("searchList") + self.verticalLayout_3.addWidget(self.searchList) + self.horizontalLayout_2 = QtWidgets.QHBoxLayout() + self.horizontalLayout_2.setObjectName("horizontalLayout_2") + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.horizontalLayout_2.addItem(spacerItem) + self.runBotton = QtWidgets.QPushButton(self.centralwidget) + self.runBotton.setObjectName("runBotton") + self.horizontalLayout_2.addWidget(self.runBotton) + self.verticalLayout_3.addLayout(self.horizontalLayout_2) + MainWindow.setCentralWidget(self.centralwidget) + self.menubar = QtWidgets.QMenuBar(MainWindow) + self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 36)) + self.menubar.setObjectName("menubar") + self.menu_2 = QtWidgets.QMenu(self.menubar) + self.menu_2.setObjectName("menu_2") + self.menu = QtWidgets.QMenu(self.menubar) + self.menu.setObjectName("menu") + MainWindow.setMenuBar(self.menubar) + self.about = QtWidgets.QAction(MainWindow) + self.about.setObjectName("about") + self.exitProgram = QtWidgets.QAction(MainWindow) + self.exitProgram.setObjectName("exitProgram") + self.help = QtWidgets.QAction(MainWindow) + self.help.setObjectName("help") + self.openFile = QtWidgets.QAction(MainWindow) + self.openFile.setObjectName("openFile") + self.menu_2.addAction(self.help) + self.menu_2.addSeparator() + self.menu_2.addAction(self.about) + self.menu.addAction(self.openFile) + self.menu.addSeparator() + self.menu.addAction(self.exitProgram) + self.menubar.addAction(self.menu.menuAction()) + self.menubar.addAction(self.menu_2.menuAction()) + + self.retranslateUi(MainWindow) + QtCore.QMetaObject.connectSlotsByName(MainWindow) + + def retranslateUi(self, MainWindow): + _translate = QtCore.QCoreApplication.translate + MainWindow.setWindowTitle(_translate("MainWindow", "自动部署脚本")) + self.searchTips.setText(_translate("MainWindow", "搜索内容(为空代表显示所有内容):")) + self.saerchBotton.setText(_translate("MainWindow", "搜索")) + self.runBotton.setText(_translate("MainWindow", "部署此方案")) + self.menu_2.setTitle(_translate("MainWindow", "帮助")) + self.menu.setTitle(_translate("MainWindow", "程序")) + self.about.setText(_translate("MainWindow", "关于")) + self.exitProgram.setText(_translate("MainWindow", "退出程序")) + self.help.setText(_translate("MainWindow", "帮助")) + self.openFile.setText(_translate("MainWindow", "打开本地部署脚本")) diff --git a/UI/AutoConfig.ui b/UI/AutoConfig.ui new file mode 100644 index 0000000..9b491ca --- /dev/null +++ b/UI/AutoConfig.ui @@ -0,0 +1,119 @@ + + + MainWindow + + + + 0 + 0 + 800 + 600 + + + + 自动部署脚本 + + + + + + + + + 搜索内容(为空代表显示所有内容): + + + + + + + + + + 搜索 + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + 部署此方案 + + + + + + + + + + + 0 + 0 + 800 + 36 + + + + + 帮助 + + + + + + + + 程序 + + + + + + + + + + + 关于 + + + + + 退出程序 + + + + + 帮助 + + + + + 打开本地部署脚本 + + + + + + diff --git a/UI/__pycache__/AutoConfig.cpython-310.pyc b/UI/__pycache__/AutoConfig.cpython-310.pyc new file mode 100644 index 0000000..7373c61 Binary files /dev/null and b/UI/__pycache__/AutoConfig.cpython-310.pyc differ diff --git a/UI/__pycache__/AutoConfig.cpython-37.pyc b/UI/__pycache__/AutoConfig.cpython-37.pyc new file mode 100644 index 0000000..ebd2bd8 Binary files /dev/null and b/UI/__pycache__/AutoConfig.cpython-37.pyc differ diff --git a/__pycache__/InstallDll.cpython-310.pyc b/__pycache__/InstallDll.cpython-310.pyc index 413ca44..1bd8bb0 100644 Binary files a/__pycache__/InstallDll.cpython-310.pyc and b/__pycache__/InstallDll.cpython-310.pyc differ diff --git a/__pycache__/InstallDll.cpython-37.pyc b/__pycache__/InstallDll.cpython-37.pyc new file mode 100644 index 0000000..a4b60d4 Binary files /dev/null and b/__pycache__/InstallDll.cpython-37.pyc differ diff --git a/__pycache__/InstallFont.cpython-310.pyc b/__pycache__/InstallFont.cpython-310.pyc new file mode 100644 index 0000000..350962d Binary files /dev/null and b/__pycache__/InstallFont.cpython-310.pyc differ diff --git a/__pycache__/InstallFont.cpython-37.pyc b/__pycache__/InstallFont.cpython-37.pyc new file mode 100644 index 0000000..7f2e1dd Binary files /dev/null and b/__pycache__/InstallFont.cpython-37.pyc differ diff --git a/__pycache__/InstallMsxml.cpython-310.pyc b/__pycache__/InstallMsxml.cpython-310.pyc new file mode 100644 index 0000000..91b889f Binary files /dev/null and b/__pycache__/InstallMsxml.cpython-310.pyc differ diff --git a/__pycache__/InstallMsxml.cpython-37.pyc b/__pycache__/InstallMsxml.cpython-37.pyc new file mode 100644 index 0000000..68c0bc6 Binary files /dev/null and b/__pycache__/InstallMsxml.cpython-37.pyc differ diff --git a/__pycache__/InstallNetFramework.cpython-310.pyc b/__pycache__/InstallNetFramework.cpython-310.pyc new file mode 100644 index 0000000..08e379d Binary files /dev/null and b/__pycache__/InstallNetFramework.cpython-310.pyc differ diff --git a/__pycache__/InstallNetFramework.cpython-37.pyc b/__pycache__/InstallNetFramework.cpython-37.pyc new file mode 100644 index 0000000..7abd065 Binary files /dev/null and b/__pycache__/InstallNetFramework.cpython-37.pyc differ diff --git a/__pycache__/InstallVisualCPlusPlus.cpython-310.pyc b/__pycache__/InstallVisualCPlusPlus.cpython-310.pyc new file mode 100644 index 0000000..85b593e Binary files /dev/null and b/__pycache__/InstallVisualCPlusPlus.cpython-310.pyc differ diff --git a/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc b/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc new file mode 100644 index 0000000..ae27162 Binary files /dev/null and b/__pycache__/InstallVisualCPlusPlus.cpython-37.pyc differ diff --git a/information.json b/information.json index 60a4ce1..b36c36f 100755 --- a/information.json +++ b/information.json @@ -13,7 +13,7 @@ "感谢 @PossibleVing 提供的新版应用图标", "感谢 @zhengjl 反馈的 1.7.0 中 .net framrwork 3.5 非离线版安装包的问题以及 1.8.0 重复路径一直自动重复增加的问题", "感谢 @国川 @刘岐 提供的非 i386、amd64 运行 wine 使用 i386/amd64 可执行文件的教程和脚本", - "感谢 @勇往直前 梦想启航 @189******09 @tfhyl 提供在非 X86 平台的国产 PC 进行测试", + "感谢 @王俊文 @189******09 @tfhyl 提供在非 X86 平台的国产 PC 进行测试", "感谢 @cuisirwork 提供的提供视频教程的建议", "感谢 @办公助手 提供的非 X86 平台 Wine 运行自定义 exe 应用教程和 deb 包", "感谢 @季星火 反馈的无法使用该程序删除生成的 .desktop 的问题", diff --git a/mainwindow.py b/mainwindow.py index 9775c54..925b1d8 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -653,7 +653,15 @@ def ThankWindow(): about_this_program() def InstallWineFont(): - threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo ss-apt-fast install ms-core-fonts winfonts -y' --keep-open"]).start() + # 筛选 apt + if not os.system("which aptss"): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo aptss install ms-core-fonts -y' --keep-open"]).start() + elif not os.system("which ss-apt-fast"): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo ss-apt-fast update && sudo ss-apt-fast install ms-core-fonts -y' --keep-open"]).start() + elif not os.system("which apt-fast"): + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo apt-fast install ms-core-fonts -y' --keep-open"]).start() + else: + threading.Thread(target=os.system, args=[f"'{programPath}/launch.sh' deepin-terminal -C 'echo 这些字体来自星火应用商店 && sudo apt install ms-core-fonts -y' --keep-open"]).start() def WineRunnerBugUpload(): threading.Thread(target=os.system, args=[f"'{programPath}/deepin-wine-runner-update-bug'"]).start() @@ -1346,7 +1354,8 @@ exe路径\' 参数 \' N: 鉴于仓库 'https://community-packages.deepin.com/beige beige InRelease' 不支持 'i386' 体系结构,跳过配置文件 'main/binary-i386/Packages' 的获取。''' updateThingsString = '''※1、新增新的 Wine 安装器,并支持将安装的 Wine 打包到 Wine 程序 deb 包中 ※2、Wine 打包器打包 Windows 应用支持将 Wine 打包入 deb 内,可以不依赖 Wine(一般不推荐把 Wine 打包入内,推荐用依赖的形式),并支持设置自定义依赖和生成模板 -※3、开始初步多语言支持 +※3、开始初步多语言支持 +※4、修复了在没有安装任何 Wine 的情况下使用高级功能导致程序闪退的问题 4、修改错别字(图形话=>图形化) 5、修复评分功能名称为空也可以上传评分的问题 6、去除 toilet 依赖,使在 Deepin 23 Preview 上运行更佳 @@ -1806,6 +1815,10 @@ if len(sys.argv) > 1 and sys.argv[1]: e2.setEditText(sys.argv[1]) if not os.path.exists("/opt/durapps/spark-dwine-helper/spark-dwine-helper-settings/settings.sh"): sparkWineSetting.setEnabled(False) -#ProgramRunStatusShow.ShowWindow() -#ProgramRunStatusUpload.ShowWindow() +if o1.currentText() == "": + # 一个 Wine 都没有却用 Wine 的功能 + # 还是要处理的,至少不会闪退 + wine["没有识别到任何Wine,请在菜单栏“程序”安装Wine或安装任意Wine应用"] = "没有识别到任何Wine,请在菜单栏“程序”安装Wine或安装任意Wine应用" + canUseWine.append("没有识别到任何Wine,请在菜单栏“程序”安装Wine或安装任意Wine应用") + o1.addItem("没有识别到任何Wine,请在菜单栏“程序”安装Wine或安装任意Wine应用") sys.exit(app.exec_()) diff --git a/wine/installwine b/wine/installwine index 469706e..fd1c6da 100644 --- a/wine/installwine +++ b/wine/installwine @@ -2,7 +2,7 @@ # 本来是用C++写的,但在非deepin/UOS编译/运行就是下载不了https文件,只能用python重写 ######################################################################### # 作者:gfdgd xi、为什么您不喜欢熊出没和阿布 -# 版本:2.0.1 +# 版本:2.1.0 # 感谢:感谢 deepin-wine 团队,提供了 deepin-wine 给大家使用,让我能做这个程序 # 基于 Python3 的 PyQt5 构建 #########################################################################