Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lilingfengdev committed Jun 28, 2024
1 parent 9336753 commit 7185cdd
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions generate-bundle.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import urllib.request
import zipfile
import platform
from concurrent.futures.process import ProcessPoolExecutor

if platform.system() == 'Windows':
os.system("pip install rtoml-0.10.0-cp311-none-win_amd64.whl ")
Expand All @@ -23,12 +24,14 @@
if os.path.exists("dist"):
shutil.rmtree("dist")

os.mkdir("build")
os.mkdir("dist")

for file in os.listdir(os.path.join(os.getcwd(), "src")):

def build(file):
filepath = os.path.join(os.getcwd(), "src", file)
print(f"build {file}", flush=True)
args = ["nuitka", "--onefile", filepath, "--output-dir=dist", "--quiet", "--assume-yes-for-downloads"]
args = ["nuitka", "--onefile", filepath, "--assume-yes-for-downloads", "--output-dir=build"]
if platform.system() == 'Windows':
args.append("--windows-icon-from-ico=favicon.png")
args.append("--enable-plugins=upx")
Expand All @@ -40,6 +43,15 @@
print(" ".join(args))
sys.argv = args
nuitka.__main__.main()
filename = os.path.splitext(file)[0] + ".exe"
shutil.move(os.path.join(os.getcwd(), "build", filename), os.path.join(os.getcwd(), "dist", filename))


pool = ProcessPoolExecutor(max_workers=4)
for file in os.listdir(os.path.join(os.getcwd(), "src")):
pool.submit(build, file)
...
pool.shutdown(wait=True)

# 傻逼
# 狗屎代碼

0 comments on commit 7185cdd

Please sign in to comment.