-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
lilingfengdev
committed
Jun 28, 2024
1 parent
f87aacb
commit 2302f56
Showing
4 changed files
with
20 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,14 @@ jobs: | |
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.11" | ||
- name: Set up MinGW | ||
uses: egor-tensin/setup-mingw@v2 | ||
with: | ||
platform: x64 | ||
- name: ccache | ||
uses: hendrikmuhs/[email protected] | ||
with: | ||
create-symlink: true | ||
- name: Install Dependencies and Generate Bundle | ||
run: | | ||
python generate-bundle.py | ||
|
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
import os | ||
import shutil | ||
import subprocess | ||
import urllib.request | ||
import zipfile | ||
import platform | ||
|
||
if platform.system() == 'Windows': | ||
os.system("python3 -m pip install pyyaml install-jdk tqdm psutil requests pygithub " | ||
"rtoml-0.10.0-cp311-none-win_amd64.whl pyinstaller") | ||
"rtoml-0.10.0-cp311-none-win_amd64.whl nuitka") | ||
urllib.request.urlretrieve("https://github.com/upx/upx/releases/download/v4.2.4/upx-4.2.4-win64.zip", | ||
"upx.zip") | ||
zip = zipfile.ZipFile("upx.zip") | ||
zip.extract("upx-4.2.4-win64/upx.exe", path=os.getcwd()) | ||
shutil.move("upx-4.2.4-win64/upx.exe", os.path.join(os.getcwd(), "upx.exe")) | ||
else: | ||
os.system("python3 -m pip install pyyaml install-jdk tqdm psutil requests pygithub rtoml pyinstaller") | ||
|
||
import PyInstaller.__main__ | ||
os.system("python3 -m pip install pyyaml install-jdk tqdm psutil requests pygithub rtoml nuitka") | ||
|
||
os.mkdir("dist") | ||
for file in os.listdir(os.path.join(os.getcwd(), "src")): | ||
filepath = os.path.join(os.getcwd(), "src", file) | ||
print(f"build {file}", flush=True) | ||
flag = ["-F", filepath, "--optimize", "2", "-i", "favicon.ico"] | ||
if platform.system() != 'Windows': | ||
flag.append("--strip") | ||
PyInstaller.__main__.run(flag) | ||
args = ["python3", "-m", "nuitka", "--lto=yes", "--onefile", filepath, "--output-dir=dist"] | ||
if platform.system() == 'Windows': | ||
args.append("--windows-icon-from-ico=favicon.png") | ||
if platform.system() == 'MacOS': | ||
args.append("--macos-app-icon=favicon.png") | ||
subprocess.call(args) | ||
if platform.system() == 'Windows': | ||
subprocess.call(["upx.exe", os.path.join(os.getcwd(), "dist", file + ".exe"), "-o", | ||
os.path.join(os.getcwd(), "dist", file + ".exe"), "-9", "-q"]) | ||
# 傻逼 | ||
# 狗屎代碼 |