mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-12 01:28:28 +08:00
优化wine运行器更新策略
This commit is contained in:
parent
cc9298f6af
commit
8a061efa2b
@ -11,6 +11,7 @@
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import updatekiller
|
||||
|
||||
def AddSparkStoreSource():
|
||||
# Download and install key
|
||||
|
@ -14,6 +14,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import pyquery
|
||||
import updatekiller
|
||||
import req as requests
|
||||
import urllib.parse as parse
|
||||
|
||||
|
@ -15,6 +15,7 @@ import sys
|
||||
import base64
|
||||
import json
|
||||
import traceback
|
||||
import updatekiller
|
||||
import urllib.request
|
||||
import req as requests
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import traceback
|
||||
import updatekiller
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
@ -12,6 +12,7 @@ import sys
|
||||
import time
|
||||
import json
|
||||
import random
|
||||
import updatekiller
|
||||
# 阉割 Android 应用安装功能
|
||||
#import uengineapi
|
||||
import platform
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import traceback
|
||||
import req as requests
|
||||
def exit():
|
||||
|
@ -14,6 +14,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import shutil
|
||||
import updatekiller
|
||||
import req as requests
|
||||
homePath = os.path.expanduser('~')
|
||||
try:
|
||||
|
@ -12,6 +12,7 @@
|
||||
#################
|
||||
import os
|
||||
import sys
|
||||
import updatekiller
|
||||
import traceback
|
||||
import pyquery
|
||||
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import req as requests
|
||||
try:
|
||||
sourcesList = [
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import req as requests
|
||||
try:
|
||||
sourcesList = [
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import req as requests
|
||||
try:
|
||||
sourcesList = [
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import req as requests
|
||||
try:
|
||||
sourcesList = [
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import req as requests
|
||||
try:
|
||||
sourcesList = [
|
||||
|
@ -11,6 +11,7 @@
|
||||
# 引入所需的库
|
||||
#################
|
||||
import os
|
||||
import updatekiller
|
||||
|
||||
def InstallWithDeepinSource(program):
|
||||
os.system(f"sudo cp '{programPath}/deepin.list' /etc/apt/sources.list.d/deepin20-withwinerunner.list")
|
||||
|
@ -12,6 +12,7 @@
|
||||
#################
|
||||
import os
|
||||
import webbrowser
|
||||
import updatekiller
|
||||
|
||||
def YesOrNo():
|
||||
if input().replace(" ", "").upper() == "N":
|
||||
|
3
Makefile
3
Makefile
@ -28,6 +28,7 @@ package:
|
||||
cp -rv QemuDownload.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv QemuRun.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv kill.sh deb/opt/apps/deepin-wine-runner
|
||||
cp -rv updatekiller.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv InstallWineOnDeepin23Alpha.py deb/opt/apps/deepin-wine-runner
|
||||
cp -rv wrestool deb/opt/apps/deepin-wine-runner
|
||||
cp -rv Mount.sh deb/opt/apps/deepin-wine-runner
|
||||
@ -142,7 +143,7 @@ install:
|
||||
sudo apt reinstall ./spark-deepin-wine-runner.deb -y --allow-downgrades
|
||||
|
||||
remove:
|
||||
sudo apt purge spark-deepin-wine-runner
|
||||
sudo apt purge spark-deepin-wine-runner -y
|
||||
|
||||
run:
|
||||
python3 mainwindow.py
|
||||
|
@ -3,6 +3,7 @@ import os
|
||||
import sys
|
||||
import base64
|
||||
import traceback
|
||||
import updatekiller
|
||||
import req as requests
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtCore as QtCore
|
||||
|
@ -13,6 +13,7 @@ import os
|
||||
import shutil
|
||||
import random
|
||||
import sys
|
||||
import updatekiller
|
||||
import json
|
||||
import traceback
|
||||
import requests
|
||||
|
@ -2,6 +2,7 @@
|
||||
import os
|
||||
import sys
|
||||
import getpass
|
||||
import updatekiller
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import updatekiller
|
||||
|
||||
if __name__ == "__main__":
|
||||
print('''
|
||||
|
@ -3,6 +3,7 @@ import os
|
||||
import sys
|
||||
import json
|
||||
import time
|
||||
import updatekiller
|
||||
import random
|
||||
import xpinyin
|
||||
import traceback
|
||||
|
@ -13,6 +13,7 @@
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import updatekiller
|
||||
import threading
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
||||
|
@ -15,6 +15,7 @@ import json
|
||||
import shutil
|
||||
import random
|
||||
import pathlib
|
||||
import updatekiller
|
||||
import threading
|
||||
import traceback
|
||||
import subprocess
|
||||
|
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python3
|
||||
import os
|
||||
import sys
|
||||
import updatekiller
|
||||
import threading
|
||||
import PyQt5.QtGui as QtGui
|
||||
import PyQt5.QtWidgets as QtWidgets
|
||||
|
@ -12,6 +12,7 @@
|
||||
#################
|
||||
import os
|
||||
import sys
|
||||
import updatekiller
|
||||
|
||||
###################
|
||||
# 程序所需事件
|
||||
|
@ -13,6 +13,7 @@ import os
|
||||
import shutil
|
||||
import random
|
||||
import sys
|
||||
import updatekiller
|
||||
import json
|
||||
import traceback
|
||||
import requests
|
||||
|
@ -22,6 +22,7 @@ import platform
|
||||
import threading
|
||||
import traceback
|
||||
import webbrowser
|
||||
import updatekiller
|
||||
import subprocess
|
||||
import req as requests
|
||||
import urllib.parse as parse
|
||||
@ -1122,7 +1123,7 @@ class UpdateWindow():
|
||||
updateWidgetLayout = QtWidgets.QGridLayout()
|
||||
versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:未知\n更新内容:")
|
||||
updateText = QtWidgets.QTextBrowser()
|
||||
ok = QtWidgets.QPushButton(transla.transe("U", "更新(更新后需要自行手动重启程序)"))
|
||||
ok = QtWidgets.QPushButton(transla.transe("U", "更新(更新时会自动关闭 Wine 运行器)"))
|
||||
ok.clicked.connect(UpdateWindow.Update)
|
||||
cancel = QtWidgets.QPushButton("取消")
|
||||
cancel.clicked.connect(UpdateWindow.update.close)
|
||||
@ -1177,8 +1178,8 @@ class UpdateWindow():
|
||||
write_txt("/tmp/spark-deepin-wine-runner/update.sh", f"""#!/bin/bash
|
||||
echo 删除多余的安装包
|
||||
rm -rfv /tmp/spark-deepin-wine-runner/update/*
|
||||
#echo 关闭“Wine 运行器”以及其它“Python 应用”
|
||||
#killall python3
|
||||
echo 关闭“Wine 运行器”
|
||||
python3 "{programPath}/updatekiller.py"
|
||||
echo 下载安装包
|
||||
wget -P /tmp/spark-deepin-wine-runner/update {UpdateWindow.data["Url"][0]}
|
||||
echo 安装安装包
|
||||
|
33
updatekiller.py
Executable file
33
updatekiller.py
Executable file
@ -0,0 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import atexit
|
||||
|
||||
PIDFILE = '/tmp/deepin-wine-runner.pid'
|
||||
|
||||
#程序结束时清理pid
|
||||
@atexit.register
|
||||
def remove_pid():
|
||||
with open(PIDFILE) as pidfile:
|
||||
pidlst = pidfile.readlines()
|
||||
pidlst.remove(str(PID)+'\n')
|
||||
with open(PIDFILE,'w') as pidfile:
|
||||
pidfile.writelines(pidlst)
|
||||
|
||||
#更新时结束进程
|
||||
def main():
|
||||
for i in open(PIDFILE):
|
||||
try:
|
||||
os.kill(int(i),15)
|
||||
except ProcessLookupError:
|
||||
pass
|
||||
os.remove(PIDFILE)
|
||||
|
||||
#当该程序被直接执行时,执行结束进程操作。如果是导入的形式,则只是记录pid
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
||||
else:
|
||||
#获取进程pid,用于更新时结束进程
|
||||
PID = os.getpid()
|
||||
with open(PIDFILE,'a') as pidfile:
|
||||
print(PID,file=pidfile) #使用print可以在行末输出换行符,而且可以省去类型转换
|
Loading…
Reference in New Issue
Block a user