加上cx_freeze的构建

This commit is contained in:
shenjack 2024-08-03 22:12:01 +08:00
parent 02e73e18ea
commit 1f22e240f9
Signed by: shenjack
GPG Key ID: 7B1134A979775551
2 changed files with 52 additions and 2 deletions

4
DR.py
View File

@ -28,8 +28,8 @@ def print_path() -> None:
def modify_path() -> None: def modify_path() -> None:
os.chdir(Path(__file__).parent) # 将运行路径切换到文件位置 防止bug os.chdir(Path(sys.argv[0]).parent) # 将运行路径切换到文件位置 防止bug
sys.path.append("./libs") # 添加 libs path # sys.path.append("./libs") # 添加 libs path
def start(start_time_ns: int) -> None: def start(start_time_ns: int) -> None:

50
scripts/package.py Normal file
View File

@ -0,0 +1,50 @@
from cx_Freeze import setup, Executable
import tomli
import sys
sys.path.append(".")
from Difficult_Rocket import sdk_version
with open("pyproject.toml", "rb") as f:
py_project = tomli.load(f)
# Dependencies are automatically detected, but it might need
# fine tuning.
build_options = {
"build_exe": "build/cx",
"packages": [],
"excludes": [
"test",
"asyncio",
"tkinter",
"unitest",
"http",
"html",
"logging",
"email",
"distutils",
"unittest",
"concurrent",
"pydoc_data",
"lzma",
"zipp",
"nuitka",
"PIL",
"bz2",
"numpy",
"ssl"
],
"zip_include_packages": ["pyglet"],
"include_files": py_project["tool"]["lndl"]["nuitka"]["cli"]["include-data-dir"],
}
base = "console"
executables = [Executable("DR.py", base=base)]
setup(
name="DR",
version=str(sdk_version),
description=py_project["tool"]["lndl"]["nuitka"]["cli"]["file-description"],
options={"build_exe": build_options},
executables=executables,
)