mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
debug build
Update build.py 1
This commit is contained in:
parent
92030d892b
commit
63b52b0766
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@ -15,8 +15,16 @@ jobs:
|
|||||||
include:
|
include:
|
||||||
- architecture: x86
|
- architecture: x86
|
||||||
fname: LunaTranslator_x86
|
fname: LunaTranslator_x86
|
||||||
|
debug: 0
|
||||||
- architecture: x64
|
- architecture: x64
|
||||||
fname: LunaTranslator
|
fname: LunaTranslator
|
||||||
|
debug: 0
|
||||||
|
- architecture: x86
|
||||||
|
fname: LunaTranslator_x86_debug
|
||||||
|
debug: 1
|
||||||
|
- architecture: x64
|
||||||
|
fname: LunaTranslator_debug
|
||||||
|
debug: 1
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -38,7 +46,7 @@ jobs:
|
|||||||
run: pip install cmake pefile requests
|
run: pip install cmake pefile requests
|
||||||
- name: Run build script
|
- name: Run build script
|
||||||
run: |
|
run: |
|
||||||
python build.py ${{ matrix.architecture }}
|
python build.py ${{ matrix.architecture }} ${{ matrix.debug }}
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.fname }}
|
name: ${{ matrix.fname }}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
import time
|
import time
|
||||||
import re
|
import keeprefs
|
||||||
import os, threading, codecs
|
import os, threading
|
||||||
from traceback import print_exc
|
from traceback import print_exc
|
||||||
from myutils.config import (
|
from myutils.config import (
|
||||||
globalconfig,
|
globalconfig,
|
||||||
savehook_new_list,
|
savehook_new_list,
|
||||||
savehook_new_data,
|
savehook_new_data,
|
||||||
noundictconfig,
|
|
||||||
transerrorfixdictconfig,
|
|
||||||
setlanguage,
|
setlanguage,
|
||||||
_TR,
|
|
||||||
static_data,
|
static_data,
|
||||||
)
|
)
|
||||||
import zipfile
|
import zipfile
|
||||||
@ -22,12 +19,11 @@ from myutils.utils import (
|
|||||||
getpostfile,
|
getpostfile,
|
||||||
stringfyerror,
|
stringfyerror,
|
||||||
)
|
)
|
||||||
import os, hashlib
|
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from PyQt5.QtCore import Qt, QSize, QObject, QEvent
|
from PyQt5.QtCore import Qt, QObject, QEvent
|
||||||
from myutils.wrapper import threader, tryprint
|
from myutils.wrapper import threader
|
||||||
from gui.showword import searchwordW
|
from gui.showword import searchwordW
|
||||||
from myutils.hwnd import getpidexe, testprivilege, ListProcess
|
from myutils.hwnd import getpidexe, ListProcess
|
||||||
from textsource.copyboard import copyboard
|
from textsource.copyboard import copyboard
|
||||||
from textsource.texthook import texthook
|
from textsource.texthook import texthook
|
||||||
from textsource.ocrtext import ocrtext
|
from textsource.ocrtext import ocrtext
|
||||||
@ -42,14 +38,12 @@ from functools import partial
|
|||||||
from gui.settin import Settin
|
from gui.settin import Settin
|
||||||
from gui.showocrimage import showocrimage
|
from gui.showocrimage import showocrimage
|
||||||
from gui.attachprocessdialog import AttachProcessDialog
|
from gui.attachprocessdialog import AttachProcessDialog
|
||||||
import hmac, pytz, uuid
|
|
||||||
import xml.etree.ElementTree as ET
|
|
||||||
import windows
|
import windows
|
||||||
import re, gobject
|
import gobject
|
||||||
import winsharedutils
|
import winsharedutils
|
||||||
from winsharedutils import pid_running
|
from winsharedutils import pid_running
|
||||||
from myutils.post import POSTSOLVE
|
from myutils.post import POSTSOLVE
|
||||||
from gui.usefulwidget import Prompt, getQMessageBox
|
from gui.usefulwidget import Prompt
|
||||||
|
|
||||||
|
|
||||||
class _autolock:
|
class _autolock:
|
||||||
|
5
LunaTranslator/LunaTranslator/keeprefs.py
Normal file
5
LunaTranslator/LunaTranslator/keeprefs.py
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import hmac
|
||||||
|
import pytz
|
||||||
|
import uuid
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
import hashlib
|
@ -1 +1 @@
|
|||||||
%LOCALAPPDATA%\Programs\Python\Python37-32\python.exe -m nuitka --standalone --windows-disable-console --plugin-enable=pyqt5 --output-dir=..\build\x86 LunaTranslator\LunaTranslator_main.py --windows-icon-from-ico=..\plugins\exec\luna.ico
|
%LOCALAPPDATA%\Programs\Python\Python37-32\python.exe -m nuitka --standalone --disable-console --plugin-enable=pyqt5 --output-dir=..\build\x86 LunaTranslator\LunaTranslator_main.py --windows-icon-from-ico=..\plugins\exec\luna.ico
|
@ -1 +1 @@
|
|||||||
%LOCALAPPDATA%\Programs\Python\Python37\python.exe -m nuitka --standalone --windows-disable-console --plugin-enable=pyqt5 --output-dir=..\build\x64 LunaTranslator\LunaTranslator_main.py --windows-icon-from-ico=..\plugins\exec\luna.ico
|
%LOCALAPPDATA%\Programs\Python\Python37\python.exe -m nuitka --standalone --disable-console --plugin-enable=pyqt5 --output-dir=..\build\x64 LunaTranslator\LunaTranslator_main.py --windows-icon-from-ico=..\plugins\exec\luna.ico
|
@ -2,6 +2,7 @@ import pefile
|
|||||||
import os,shutil,sys
|
import os,shutil,sys
|
||||||
print(sys.argv)
|
print(sys.argv)
|
||||||
x86=int(sys.argv[1])
|
x86=int(sys.argv[1])
|
||||||
|
isdebug=len(sys.argv)>2 and int(sys.argv[2])
|
||||||
if x86:
|
if x86:
|
||||||
nuitkadist=r'..\build\x86\LunaTranslator_main.dist'
|
nuitkadist=r'..\build\x86\LunaTranslator_main.dist'
|
||||||
targetdir=r'..\build\LunaTranslator_x86'
|
targetdir=r'..\build\LunaTranslator_x86'
|
||||||
@ -16,6 +17,16 @@ else:
|
|||||||
nuitkadist=r'..\build\x64\LunaTranslator_main.dist'
|
nuitkadist=r'..\build\x64\LunaTranslator_main.dist'
|
||||||
targetdir=r'..\build\LunaTranslator'
|
targetdir=r'..\build\LunaTranslator'
|
||||||
downlevel=r'C:\Windows\system32\downlevel'
|
downlevel=r'C:\Windows\system32\downlevel'
|
||||||
|
if isdebug:
|
||||||
|
targetdir+=r'_debug'
|
||||||
|
if x86:
|
||||||
|
nuitkadist=r'..\build\x86_debug\LunaTranslator_main.dist'
|
||||||
|
target='LunaTranslator_x86_debug.zip'
|
||||||
|
else:
|
||||||
|
nuitkadist=r'..\build\x64_debug\LunaTranslator_main.dist'
|
||||||
|
target='LunaTranslator_debug.zip'
|
||||||
|
|
||||||
|
|
||||||
targetdir_in=rf'{targetdir}\LunaTranslator'
|
targetdir_in=rf'{targetdir}\LunaTranslator'
|
||||||
def get_import_table(file_path):
|
def get_import_table(file_path):
|
||||||
pe = pefile.PE(file_path)
|
pe = pefile.PE(file_path)
|
||||||
|
83
build.py
83
build.py
@ -3,9 +3,6 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
msbuildPath = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\MSBuild\\Current\\Bin\\MSBuild.exe"
|
|
||||||
vcvars32Path = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars32.bat"
|
|
||||||
vcvars64Path = "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat"
|
|
||||||
|
|
||||||
pluginDirs = ["DLL32", "DLL64", "Locale_Remulator", "LunaHook", "Magpie", "NTLEAS"]
|
pluginDirs = ["DLL32", "DLL64", "Locale_Remulator", "LunaHook", "Magpie", "NTLEAS"]
|
||||||
|
|
||||||
@ -213,52 +210,60 @@ def buildPlugins():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
arch = sys.argv[1]
|
arch = sys.argv[1]
|
||||||
|
isdebug=len(sys.argv)>2 and int(sys.argv[2])
|
||||||
os.chdir(rootDir)
|
os.chdir(rootDir)
|
||||||
os.makedirs("temp", exist_ok=True)
|
os.makedirs("temp", exist_ok=True)
|
||||||
|
|
||||||
createPluginDirs()
|
createPluginDirs()
|
||||||
|
|
||||||
def __1():
|
|
||||||
downloadBrotli()
|
|
||||||
downloadLocaleEmulator()
|
|
||||||
downloadNtlea()
|
|
||||||
downloadCurl()
|
|
||||||
downloadOCRModel("ja")
|
|
||||||
downloadcommon()
|
|
||||||
buildLunaHook()
|
|
||||||
|
|
||||||
def __2():
|
downloadBrotli()
|
||||||
installVCLTL()
|
downloadLocaleEmulator()
|
||||||
buildPlugins()
|
downloadNtlea()
|
||||||
|
downloadCurl()
|
||||||
|
downloadOCRModel("ja")
|
||||||
|
downloadcommon()
|
||||||
|
buildLunaHook()
|
||||||
|
|
||||||
def __3():
|
|
||||||
os.chdir(rootDir)
|
|
||||||
|
|
||||||
py37Path32 = "C:\\hostedtoolcache\\windows\\Python\\3.7.9\\x86\\python.exe"
|
|
||||||
py37Path64 = "C:\\hostedtoolcache\\windows\\Python\\3.7.9\\x64\\python.exe"
|
|
||||||
|
|
||||||
if arch == "x86":
|
installVCLTL()
|
||||||
subprocess.run(f"{py37Path32} -m pip install --upgrade pip")
|
buildPlugins()
|
||||||
else:
|
|
||||||
subprocess.run(f"{py37Path64} -m pip install --upgrade pip")
|
|
||||||
|
|
||||||
os.chdir(rootDir + "\\LunaTranslator")
|
|
||||||
|
|
||||||
if arch == "x86":
|
os.chdir(rootDir)
|
||||||
subprocess.run(f"{py37Path32} -m pip install -r requirements.txt")
|
|
||||||
subprocess.run(
|
|
||||||
f"{py37Path32} -m nuitka --standalone --assume-yes-for-downloads --windows-disable-console --plugin-enable=pyqt5 --output-dir=..\\build\\x86 LunaTranslator\\LunaTranslator_main.py --windows-icon-from-ico=..\\plugins\\exec\\luna.ico"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
subprocess.run(f"{py37Path64} -m pip install -r requirements.txt")
|
|
||||||
subprocess.run(
|
|
||||||
f"{py37Path64} -m nuitka --standalone --assume-yes-for-downloads --windows-disable-console --plugin-enable=pyqt5 --output-dir=..\\build\\x64 LunaTranslator\\LunaTranslator_main.py --windows-icon-from-ico=..\\plugins\\exec\\luna.ico"
|
|
||||||
)
|
|
||||||
|
|
||||||
__1()
|
|
||||||
__2()
|
|
||||||
__3()
|
|
||||||
if arch == "x86":
|
if arch == "x86":
|
||||||
subprocess.run(f"cmd /c pack32.cmd")
|
py37Path = "C:\\hostedtoolcache\\windows\\Python\\3.7.9\\x86\\python.exe"
|
||||||
else:
|
else:
|
||||||
subprocess.run(f"cmd /c pack64.cmd")
|
py37Path = "C:\\hostedtoolcache\\windows\\Python\\3.7.9\\x64\\python.exe"
|
||||||
|
|
||||||
|
os.chdir(rootDir + "\\LunaTranslator")
|
||||||
|
|
||||||
|
cmdline=py37Path
|
||||||
|
cmdline+=' -m nuitka --standalone --assume-yes-for-downloads '
|
||||||
|
if not isdebug:
|
||||||
|
cmdline+=' --disable-console '
|
||||||
|
cmdline+=' --plugin-enable=pyqt5 '
|
||||||
|
|
||||||
|
if arch == "x86":
|
||||||
|
if isdebug:
|
||||||
|
cmdline+='--output-dir=..\\build\\x86_debug'
|
||||||
|
else:
|
||||||
|
cmdline+='--output-dir=..\\build\\x86'
|
||||||
|
else:
|
||||||
|
if isdebug:
|
||||||
|
cmdline+='--output-dir=..\\build\\x64_debug'
|
||||||
|
else:
|
||||||
|
cmdline+='--output-dir=..\\build\\x64'
|
||||||
|
cmdline+=' LunaTranslator\\LunaTranslator_main.py --windows-icon-from-ico=..\\plugins\\exec\\luna.ico '
|
||||||
|
|
||||||
|
subprocess.run(f"{py37Path} -m pip install --upgrade pip")
|
||||||
|
subprocess.run(f"{py37Path} -m pip install -r requirements.txt")
|
||||||
|
subprocess.run(cmdline)
|
||||||
|
|
||||||
|
|
||||||
|
if arch == "x86":
|
||||||
|
subprocess.run(f"cmd /c pack32.cmd {isdebug}")
|
||||||
|
else:
|
||||||
|
subprocess.run(f"cmd /c pack64.cmd {isdebug}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user