Compare commits
7 Commits
03adefb3ea
...
36ce1b9ea0
Author | SHA1 | Date | |
---|---|---|---|
36ce1b9ea0 | |||
09cd1756a9 | |||
340c7525c5 | |||
47596aa463 | |||
d584fd4e9f | |||
0dc4628be2 | |||
71473228cd |
@ -8,6 +8,7 @@ import platform
|
||||
import warnings
|
||||
from pathlib import Path
|
||||
from typing import List, Tuple, Optional, Union, Any
|
||||
from enum import Enum
|
||||
|
||||
from lib_not_dr.types import Options, Version, VersionRequirement
|
||||
|
||||
@ -46,6 +47,223 @@ def format_cmd(arg_name: Optional[str] = None,
|
||||
return [f'{arg_name}{arg_value}']
|
||||
|
||||
|
||||
class NuitkaSubConfig(Options):
|
||||
"""
|
||||
Nuitka 配置的子项
|
||||
Nuitka configuration sub-items
|
||||
"""
|
||||
name = 'Nuitka Sub Configuration'
|
||||
|
||||
def gen_cmd(self) -> List[str]:
|
||||
"""
|
||||
生成命令行参数
|
||||
:return:
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
|
||||
class NuitkaPluginConfig(NuitkaSubConfig):
|
||||
"""
|
||||
控制 nuitka 的 plugin 相关参数的部分
|
||||
Control part of nuitka's plugin related parameters
|
||||
"""
|
||||
name = 'Nuitka Plugin Configuration'
|
||||
|
||||
# --enable-plugin=PLUGIN_NAME
|
||||
enable_plugin: List[str] = []
|
||||
# --disable-plugin=PLUGIN_NAME
|
||||
disable_plugin: List[str] = []
|
||||
# --plugin-no-detection
|
||||
plugin_no_detection: bool = False
|
||||
# --user-plugin=PATH
|
||||
user_plugin: List[Path] = []
|
||||
# --show-source-changes
|
||||
show_source_changes: bool = False
|
||||
|
||||
# --include-plugin-directory=MODULE/PACKAGE
|
||||
include_plugin_dir: List[str] = []
|
||||
# --include-plugin-files=PATTERN
|
||||
include_plugin_files: List[str] = []
|
||||
|
||||
|
||||
class NuitkaIncludeConfig(NuitkaSubConfig):
|
||||
"""
|
||||
控制 nuitka 的 include 和 数据 相关参数的部分
|
||||
Control part of nuitka's include related parameters
|
||||
"""
|
||||
name = 'Nuitka Include Configuration'
|
||||
|
||||
# --include-package=PACKAGE
|
||||
include_packages: List[str] = []
|
||||
# --include-module=MODULE
|
||||
include_modules: List[str] = []
|
||||
|
||||
# --prefer-source-code
|
||||
# --no-prefer-source-code for --module
|
||||
prefer_source_code: bool = False
|
||||
# --follow-stdlib
|
||||
follow_stdlib: bool = False
|
||||
|
||||
|
||||
class NuitkaDataConfig(NuitkaSubConfig):
|
||||
"""
|
||||
控制 nuitka 的 数据 相关参数的部分
|
||||
Control part of nuitka's data related parameters
|
||||
"""
|
||||
name = 'Nuitka Data Configuration'
|
||||
|
||||
# --include-package-data=PACKAGE=PACKAGE_PATH
|
||||
include_package_data: List[Tuple[Path, Path]] = []
|
||||
# --include-data-files=PATH=PATH
|
||||
include_data_files: List[Tuple[Path, Path]] = []
|
||||
# --include-data-dir=DIRECTORY=PATH
|
||||
include_data_dir: List[Tuple[Path, Path]] = []
|
||||
|
||||
# --noinclude-data-files=PATH
|
||||
no_include_data_files: List[Path] = []\
|
||||
|
||||
# --list-package-data=LIST_PACKAGE_DATA
|
||||
list_package_data: List[str] = []
|
||||
# --list-package-dlls=LIST_PACKAGE_DLLS
|
||||
list_package_dlls: List[str] = []
|
||||
|
||||
# --include-distribution-metadata=DISTRIBUTION
|
||||
include_distribution_metadata: List[str] = []
|
||||
|
||||
|
||||
class NuitkaBinaryInfo(Options):
|
||||
"""
|
||||
nuitka 构建的二进制文件的信息
|
||||
nuitka build binary file information
|
||||
"""
|
||||
name = 'Nuitka Binary Info'
|
||||
|
||||
# --company-name=COMPANY_NAME
|
||||
company_name: Optional[str] = None
|
||||
# --product-name=PRODUCT_NAME
|
||||
product_name: Optional[str] = None
|
||||
|
||||
# --file-version=FILE_VERSION
|
||||
# --macos-app-version=MACOS_APP_VERSION
|
||||
file_version: Optional[Union[str, Version]] = None
|
||||
# --product-version=PRODUCT_VERSION
|
||||
product_version: Optional[Union[str, Version]] = None
|
||||
|
||||
# --file-description=FILE_DESCRIPTION
|
||||
file_description: Optional[str] = None
|
||||
# --copyright=COPYRIGHT_TEXT
|
||||
copyright: Optional[str] = None
|
||||
# --trademarks=TRADEMARK_TEXT
|
||||
trademarks: Optional[str] = None
|
||||
|
||||
# Icon
|
||||
# --linux-icon=ICON_PATH
|
||||
# --macos-app-icon=ICON_PATH
|
||||
# --windows-icon-from-ico=ICON_PATH
|
||||
# --windows-icon-from-exe=ICON_EXE_PATH
|
||||
# 注意: 只有 Windows 下 才可以提供多个 ICO 文件
|
||||
# 其他平台 和 EXE 下只会使用第一个路径
|
||||
icon: Optional[List[Path]] = None
|
||||
|
||||
# Console
|
||||
# --enable-console
|
||||
# --disable-console
|
||||
console: bool = True
|
||||
|
||||
# Windows UAC
|
||||
# --windows-uac-admin
|
||||
windows_uac_admin: bool = False
|
||||
# --windows-uac-uiaccess
|
||||
windows_uac_ui_access: bool = False
|
||||
|
||||
|
||||
class NuitkaOutputConfig(Options):
|
||||
"""
|
||||
nuitka 构建的选项
|
||||
nuitka build output information
|
||||
"""
|
||||
name = 'Nuitka Output Config'
|
||||
|
||||
# --output-dir=DIRECTORY
|
||||
output_dir: Optional[Path] = None
|
||||
# --output-filename=FILENAME
|
||||
output_filename: Optional[str] = None
|
||||
|
||||
# --remove-output
|
||||
remove_output: bool = False
|
||||
# --no-pyo-file
|
||||
no_pyo_file: bool = False
|
||||
|
||||
|
||||
class NuitkaDebugConfig(Options):
|
||||
"""
|
||||
nuitka 构建的调试选项
|
||||
nuikta build debug information
|
||||
"""
|
||||
name = 'Nuitka Debug Config'
|
||||
|
||||
# --debug
|
||||
debug: bool = False
|
||||
# --unstripped
|
||||
strip: bool = True
|
||||
# --profile
|
||||
profile: bool = False
|
||||
# --internal-graph
|
||||
internal_graph: bool = False
|
||||
# --trace-execution
|
||||
trace_execution: bool = False
|
||||
|
||||
|
||||
|
||||
class NuitkaTarget(Enum):
|
||||
"""
|
||||
用于指定 nuitka 构建的目标
|
||||
Use to specify the target of nuitka build
|
||||
exe: 不带任何参数
|
||||
module: --module
|
||||
standalone: --standalone
|
||||
one_file: --onefile
|
||||
"""
|
||||
exe = ''
|
||||
module = 'module'
|
||||
standalone = 'standalone'
|
||||
one_file = 'package'
|
||||
|
||||
|
||||
class NuitkaScriptGenerator(Options):
|
||||
"""
|
||||
用于帮助生成 nuitka 构建脚本的类
|
||||
Use to help generate nuitka build script
|
||||
|
||||
:arg main 需要编译的文件
|
||||
"""
|
||||
name = 'Nuitka Script Generator'
|
||||
|
||||
# --main=PATH
|
||||
# 可以有多个 输入时需要包在列表里
|
||||
main: List[Path]
|
||||
|
||||
# --run
|
||||
run_after_build: bool = False
|
||||
# --debugger
|
||||
debugger: bool = False
|
||||
# --execute-with-pythonpath
|
||||
execute_with_python_path: bool = False
|
||||
|
||||
# --assume-yes-for-downloads
|
||||
download_confirm: bool = True
|
||||
|
||||
# standalone/one_file/module/exe
|
||||
target: NuitkaTarget = NuitkaTarget.exe
|
||||
|
||||
# --python-debug
|
||||
python_debug: bool = False
|
||||
# --python-flag=FLAG
|
||||
python_flag: List[str] = []
|
||||
# --python-for-scons=PATH
|
||||
python_for_scons: Optional[Path] = None
|
||||
|
||||
|
||||
class CompilerHelper(Options):
|
||||
"""
|
||||
用于帮助生成 nuitka 构建脚本的类
|
||||
|
Loading…
Reference in New Issue
Block a user