Feature/python build #25

Merged
shenjackyuanjie merged 28 commits from feature/python_build into main 2023-06-10 19:02:01 +08:00
Showing only changes of commit e75d4171af - Show all commits

View File

@ -57,6 +57,7 @@ if __name__ == '__main__':
if do_compile == 'y': if do_compile == 'y':
# 编译 # 编译
time.sleep(1) # 等待 1s
start_time = time.time_ns() start_time = time.time_ns()
subprocess.run(compiler.gen_subprocess_cmd()) subprocess.run(compiler.gen_subprocess_cmd())
print('Compile Done!') print('Compile Done!')
@ -69,6 +70,7 @@ if __name__ == '__main__':
shutil.rmtree(compiler.output_path / 'DR.dist' / 'fonts' / 'HarmonyOS_Sans' / 'HarmonyOS_Sans', ignore_errors=True) shutil.rmtree(compiler.output_path / 'DR.dist' / 'fonts' / 'HarmonyOS_Sans' / 'HarmonyOS_Sans', ignore_errors=True)
os.remove(compiler.output_path / 'DR.dist' / 'fonts' / 'Monocraft.otf') os.remove(compiler.output_path / 'DR.dist' / 'fonts' / 'Monocraft.otf')
os.remove(compiler.output_path / 'DR.dist' / 'fonts' / 'SmileySans-Oblique.ttf') os.remove(compiler.output_path / 'DR.dist' / 'fonts' / 'SmileySans-Oblique.ttf')
print('Remove Useless Files Done!')
# 压缩 # 压缩
with zipfile.ZipFile(Path('./build/Difficult_Rocket.zip'), 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as dist_zip: 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'): for path, sub_paths, sub_files in os.walk(compiler.output_path / 'DR.dist'):
@ -76,3 +78,4 @@ if __name__ == '__main__':
for file in sub_files: for file in sub_files:
file_path = os.path.join(path, file) file_path = os.path.join(path, file)
dist_zip.write(file_path) dist_zip.write(file_path)
print('Zip Done!')