add more github compat

This commit is contained in:
shenjack 2023-06-10 15:10:44 +08:00
parent a8f5373fed
commit 6152e5f7ac

View File

@ -6,7 +6,12 @@
import sys import sys
import time import time
import shutil
import zipfile
import subprocess import subprocess
from pathlib import Path
from libs.utils import nuitka from libs.utils import nuitka
if __name__ == '__main__': if __name__ == '__main__':
@ -23,8 +28,12 @@ if __name__ == '__main__':
sys.argv.remove(compiler.output_path) sys.argv.remove(compiler.output_path)
# 检测 --github 参数 # 检测 --github 参数
is_github = False
if '--github' in sys.argv: if '--github' in sys.argv:
is_github = True
compiler.use_ccache = False compiler.use_ccache = False
compiler.show_progress = False
compiler.output_path = Path('./build/github')
print(compiler.output_path) print(compiler.output_path)
@ -34,11 +43,13 @@ if __name__ == '__main__':
# 确认是否需要编译 # 确认是否需要编译
# 如果包含 -y 参数 则直接编译 # 如果包含 -y 参数 则直接编译
if ('-y' or '-n') not in sys.argv: if ('-y' or '-n') not in sys.argv or not is_github:
while (do_compile := input('Do you want to compile this file? (y/n) ')) not in ['y', 'n']: while (do_compile := input('Do you want to compile this file? (y/n) ')) not in ['y', 'n']:
pass pass
elif '-y' in sys.argv: elif '-y' in sys.argv:
do_compile = 'y' do_compile = 'y'
elif is_github:
do_compile = 'y'
else: else:
do_compile = 'n' do_compile = 'n'
@ -48,3 +59,5 @@ if __name__ == '__main__':
subprocess.run(compiler.gen_subprocess_cmd()) subprocess.run(compiler.gen_subprocess_cmd())
print('Compile Done!') print('Compile Done!')
print(f'Compile Time: {time.time_ns() - start_time} ns ({(time.time_ns() - start_time) / 1000_000_000} s)') 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])