remove useless logger rework nuitka add cmd

This commit is contained in:
shenjack 2023-06-17 14:07:03 +08:00
parent 5b50c9a9e2
commit 76e58676de
4 changed files with 35 additions and 56 deletions

View File

@ -12,8 +12,6 @@ gitee: @shenjackyuanjie
""" """
# from Difficult_Rocket.api import screen, mod, exception
__all__ = [ __all__ = [
'exception', 'exception',
# 错误类定义 # 错误类定义

View File

@ -16,7 +16,6 @@ from Difficult_Rocket.mod.api import ModInfo
class ModManager(Options): class ModManager(Options):
name = 'Mod Manager' name = 'Mod Manager'
logger: logging.Logger
mods_path: List[Path] = [Path('./mods')] mods_path: List[Path] = [Path('./mods')]
loaded_mod_modules: Dict[str, ModInfo] = {} loaded_mod_modules: Dict[str, ModInfo] = {}

View File

@ -7,11 +7,11 @@ Thanks a lot to Fallen_Breath and MCDR contributors
GNU Lesser General Public License v3.0 (GNU LGPL v3) GNU Lesser General Public License v3.0 (GNU LGPL v3)
""" """
import re
from typing import List, Callable, Tuple, Optional, Union
""" """
Plugin Version Plugin Version
""" """
import re
from typing import List, Callable, Tuple, Optional, Union
# beta.3 -> (beta, 3), random -> (random, None) # beta.3 -> (beta, 3), random -> (random, None)

View File

@ -8,11 +8,17 @@
import platform import platform
import traceback import traceback
from pathlib import Path from pathlib import Path
from typing import List, Tuple, Optional from typing import List, Tuple, Optional, Any
from Difficult_Rocket.api.types import Options, Version from Difficult_Rocket.api.types import Options, Version
def _add_cmd(cmd: List[str], string: Optional[Any]) -> List[str]:
if string is not None and string:
cmd.append(string)
return cmd
class CompilerHelper(Options): class CompilerHelper(Options):
name = 'Nuitka Compiler Helper' name = 'Nuitka Compiler Helper'
@ -88,68 +94,44 @@ class CompilerHelper(Options):
def gen_subprocess_cmd(self) -> List[str]: def gen_subprocess_cmd(self) -> List[str]:
cmd_list = [self.python_cmd, '-m', 'nuitka'] cmd_list = [self.python_cmd, '-m', 'nuitka']
# macos 和 非 macos icon 参数不同 # macos 和 非 macos icon 参数不同
icon_cmd = ""
if platform.system() == 'Darwin': if platform.system() == 'Darwin':
icon_cmd = f"--macos-app-icon={self.icon_path.absolute()}"
cmd_list.append(f"--macos-app-version={self.product_version}") cmd_list.append(f"--macos-app-version={self.product_version}")
_add_cmd(cmd_list, f'--macos-app-icon={self.icon_path.absolute()}' if self.icon_path else None)
elif platform.system() == 'Windows': elif platform.system() == 'Windows':
icon_cmd = f"--windows-icon-from-ico={self.icon_path.absolute()}" _add_cmd(cmd_list, f'--windows-icon-from-ico={self.icon_path.absolute()}' if self.icon_path else None)
elif platform.system() == 'Linux': elif platform.system() == 'Linux':
icon_cmd = f"--linux-icon={self.icon_path.absolute()}" _add_cmd(cmd_list, f'--linux-icon={self.icon_path.absolute()}' if self.icon_path else None)
if self.use_lto: _add_cmd(cmd_list, '--lto=yes' if self.use_lto else '--lto=no')
cmd_list.append('--lto=yes') _add_cmd(cmd_list, '--clang' if self.use_clang else None)
else: _add_cmd(cmd_list, '--msvc' if self.use_msvc else None)
cmd_list.append('--lto=no') _add_cmd(cmd_list, '--mingw64' if self.use_mingw else None)
_add_cmd(cmd_list, '--standalone' if self.standalone else None)
if self.enable_console: _add_cmd(cmd_list, '--disable-ccache' if self.use_ccache else None)
cmd_list.append('--enable-console') _add_cmd(cmd_list, '--show-progress' if self.show_progress else None)
else: _add_cmd(cmd_list, '--show-memory' if self.show_memory else None)
cmd_list.append('--disable-console') _add_cmd(cmd_list, '--assume-yes-for-download' if self.download_confirm else None)
_add_cmd(cmd_list, '--enable-console' if self.enable_console else '--disable-console')
if self.use_clang: _add_cmd(cmd_list, f'--xml={self.xml_path.absolute()}' if self.save_xml else None)
cmd_list.append('--clang') _add_cmd(cmd_list, f'--output-dir={self.output_path.absolute()}' if self.output_path else None)
if self.use_msvc: _add_cmd(cmd_list, f'--company-name={self.company_name}' if self.company_name else None)
cmd_list.append('--msvc=latest') _add_cmd(cmd_list, f'--product-name={self.product_name}' if self.product_name else None)
if self.standalone: _add_cmd(cmd_list, f'--file-version={self.file_version}' if self.file_version else None)
cmd_list.append('--standalone') _add_cmd(cmd_list, f'--product-version={self.product_version}' if self.product_version else None)
if not self.use_ccache: _add_cmd(cmd_list, f'--file-description={self.file_description}' if self.file_description else None)
cmd_list.append('--disable-ccache') _add_cmd(cmd_list, f'--copy-right={self.copy_right}' if self.copy_right else None)
if self.show_progress:
cmd_list.append('--show-progress')
if self.show_memory:
cmd_list.append('--show-memory')
if self.download_confirm:
cmd_list.append('--assume-yes-for-download')
if self.save_xml:
cmd_list.append(f'--xml={self.xml_path.absolute()}')
cmd_list.append(f"--output-dir={self.output_path.absolute()}") _add_cmd(cmd_list, f'--follow-import-to={",".join(self.follow_import)}' if self.follow_import else None)
_add_cmd(cmd_list, f'--nofollow-import-to={",".join(self.no_follow_import)}' if self.no_follow_import else None)
cmd_list.append(f"--company-name={self.company_name}") _add_cmd(cmd_list, f'--enable-plugin={",".join(self.enable_plugin)}' if self.enable_plugin else None)
cmd_list.append(f"--product-name={self.product_name}") _add_cmd(cmd_list, f'--disable-plugin={",".join(self.disable_plugin)}' if self.disable_plugin else None)
cmd_list.append(f"--file-version={self.file_version}")
cmd_list.append(f"--product-version={self.product_version}")
cmd_list.append(f"--file-description={self.file_description}")
cmd_list.append(f"--copyright={self.copy_right}")
if icon_cmd:
cmd_list.append(icon_cmd)
if self.include_data_dir: if self.include_data_dir:
cmd_list += [f"--include-data-dir={src}={dst}" for src, dst in self.include_data_dir] cmd_list += [f"--include-data-dir={src}={dst}" for src, dst in self.include_data_dir]
if self.include_packages: if self.include_packages:
cmd_list += [f"--include-package={package}" for package in self.include_packages] cmd_list += [f"--include-package={package}" for package in self.include_packages]
if self.follow_import:
cmd_list.append(f"--follow-import-to={','.join(self.follow_import)}")
if self.no_follow_import:
cmd_list.append(f"--nofollow-import-to={','.join(self.no_follow_import)}")
if self.enable_plugin:
cmd_list.append(f"--enable-plugin={','.join(self.enable_plugin)}")
if self.disable_plugin:
cmd_list.append(f"--disable-plugin={','.join(self.disable_plugin)}")
cmd_list.append(f"{self.src_file}") cmd_list.append(f"{self.src_file}")
return cmd_list return cmd_list