enhance nuitka.py [build skip] [build rs skip] [page skip]
This commit is contained in:
parent
ba7651a4c4
commit
84e7c9b5df
@ -8,7 +8,7 @@
|
|||||||
import platform
|
import platform
|
||||||
import traceback
|
import traceback
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List, Tuple
|
||||||
|
|
||||||
from Difficult_Rocket.api.types import Options, Version
|
from Difficult_Rocket.api.types import Options, Version
|
||||||
|
|
||||||
@ -30,6 +30,12 @@ class Status(Options):
|
|||||||
product_version: Version
|
product_version: Version
|
||||||
file_version: Version
|
file_version: Version
|
||||||
icon_path: Path = Path('textures/icon.png')
|
icon_path: Path = Path('textures/icon.png')
|
||||||
|
follow_import: List[str] = ['pyglet', 'Difficult_Rocket.api']
|
||||||
|
no_follow_import: List[str] = ['objprint', 'pillow', 'PIL', 'cffi', 'pydoc']
|
||||||
|
include_data_dir: List[Tuple[Path, Path]] = [(Path('./libs/fonts'), Path('./libs/fonts')),
|
||||||
|
(Path('./textures'), Path('./textures')),
|
||||||
|
(Path('./configs'), Path('./configs'))]
|
||||||
|
include_packages: List[str] = []
|
||||||
|
|
||||||
def init(self, **kwargs) -> None:
|
def init(self, **kwargs) -> None:
|
||||||
# 非 windows 平台不使用 msvc
|
# 非 windows 平台不使用 msvc
|
||||||
@ -50,6 +56,11 @@ class Status(Options):
|
|||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def as_markdown(self) -> str:
|
||||||
|
front = super().as_markdown()
|
||||||
|
gen_cmd = self.gen_subprocess_cmd()
|
||||||
|
return f"{front}\n\n```bash\n{' '.join(gen_cmd)}\n```"
|
||||||
|
|
||||||
def gen_subprocess_cmd(self) -> List[str]:
|
def gen_subprocess_cmd(self) -> List[str]:
|
||||||
cmd_list = ['python', '-m', 'nuitka']
|
cmd_list = ['python', '-m', 'nuitka']
|
||||||
# macos 和 非 macos icon 参数不同
|
# macos 和 非 macos icon 参数不同
|
||||||
@ -75,6 +86,8 @@ class Status(Options):
|
|||||||
cmd_list.append(f"--product-version={self.product_version}")
|
cmd_list.append(f"--product-version={self.product_version}")
|
||||||
cmd_list.append(f"--file-version={self.file_version}")
|
cmd_list.append(f"--file-version={self.file_version}")
|
||||||
cmd_list += icon_cmd
|
cmd_list += icon_cmd
|
||||||
|
cmd_list += [f"--include-data-file={src}={dst}" for src, dst in self.include_data_dir]
|
||||||
|
cmd_list += [f"--include-package={package}" for package in self.include_packages]
|
||||||
return cmd_list
|
return cmd_list
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user