From bcc01c51f64eb2e2504ac58ebd6e5d8bb92265b4 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 10 Jun 2023 15:36:44 +0800 Subject: [PATCH] move import. add more github compile compat --- .github/workflows/post_compile.py | 2 +- nuitka_build.py | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/post_compile.py b/.github/workflows/post_compile.py index 23ed768..9db290a 100644 --- a/.github/workflows/post_compile.py +++ b/.github/workflows/post_compile.py @@ -6,8 +6,8 @@ import os import sys -import zipfile import shutil +import zipfile if sys.platform == "win32": os.system('') diff --git a/nuitka_build.py b/nuitka_build.py index 7447e14..a4e7510 100644 --- a/nuitka_build.py +++ b/nuitka_build.py @@ -4,6 +4,7 @@ # All rights reserved # ------------------------------- +import os import sys import time import shutil @@ -60,4 +61,17 @@ if __name__ == '__main__': print('Compile Done!') print(f'Compile Time: {time.time_ns() - start_time} ns ({(time.time_ns() - start_time) / 1000_000_000} s)') if is_github: - subprocess.run(['python', 'libs/utils/github.py', compiler.output_path]) + # 去除无用字体文件 + shutil.rmtree(compiler.output_path / 'fonts' / 'Fira_Code', ignore_errors=True) + shutil.rmtree(compiler.output_path / 'fonts' / 'scientifica', ignore_errors=True) + shutil.rmtree(compiler.output_path / 'fonts' / 'HarmonyOS_Sans' / 'HarmonyOS_Sans_Condensed', ignore_errors=True) + shutil.rmtree(compiler.output_path / 'fonts' / 'HarmonyOS_Sans' / 'HarmonyOS_Sans', ignore_errors=True) + os.remove(compiler.output_path / 'fonts' / 'Monocraft.otf') + os.remove(compiler.output_path / 'fonts' / 'SmileySans-Oblique.ttf') + # 压缩 + with zipfile.ZipFile(Path('./build/Difficult_Rocket.zip'), 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as dist_zip: + for path, sub_paths, sub_files in os.walk(compiler.output_path / 'DR.dist'): + print(f'writing {path}') + for file in sub_files: + file_path = os.path.join(path, file) + dist_zip.write(file_path)