From 101e4dfdd73ac978c87fef489a14d0a42ae42989 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Tue, 3 Jan 2023 15:34:06 +0800 Subject: [PATCH] feat: try icon --- .github/workflows/get_info.py | 9 ++++++--- .github/workflows/nuitka.yml | 10 +++++++--- nuitka1-complie.ps1 | 2 ++ nuitka3-complie.ps1 | 2 ++ pyproject.toml | 4 ++-- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/get_info.py b/.github/workflows/get_info.py index 9eb6c67..5d8ea3c 100644 --- a/.github/workflows/get_info.py +++ b/.github/workflows/get_info.py @@ -9,9 +9,11 @@ import sys import rtoml sys.path.append(os.path.abspath(os.curdir)) -if '-env' not in sys.argv: + +args = ['-env', ''] + +if not any([x in sys.argv for x in args]): # 没有输入参数,直接输出默认信息并输出 print(sys.version) - print(os.getenv('env:GITHUB_SHA')) from Difficult_Rocket.utils import tools # 重置窗口信息 config_file = tools.load_file('./configs/main.toml') @@ -19,11 +21,12 @@ if '-env' not in sys.argv: config_file['window']['height'] = 768 rtoml.dump(config_file, open('./configs/main.toml', 'w')) -if os.path.abspath(os.curdir) in sys.path: +if os.path.abspath(os.curdir) in sys.path and '-env' in sys.argv: from Difficult_Rocket import DR_runtime print(f'DR_version={DR_runtime.DR_version}') print(f'DR_language={DR_runtime.language}') print(f'DR_long_version={DR_runtime.DR_long_version}') + print(f'Build_version={DR_runtime.Build_version}') # os.system(f'echo "DR_version={DR_runtime.DR_version}" >> $GITHUB_OUTPUT') diff --git a/.github/workflows/nuitka.yml b/.github/workflows/nuitka.yml index a0b079c..182661b 100644 --- a/.github/workflows/nuitka.yml +++ b/.github/workflows/nuitka.yml @@ -55,7 +55,7 @@ jobs: - name: Install env run: | pip install -r requirement.txt - pip install nuitka ordered-set + pip install nuitka ordered-set imageio # 提取 DR 版本和其他信息 - name: Display Difficult-Rocket info @@ -78,8 +78,10 @@ jobs: $arg += @("--company-name=tool-shenjack-workshop") $arg += @("--product-name=Difficult-Rocket") $arg += @("--product-version=$env:DR_version") + $arg += @("--file-version=$env:Build_version") $arg += @("--file-description=Difficult-Rocket!") - $arg += @("--file-version=0.0.0.1") + $arg += @("--windows-icon-from-ico=textures/icon.png") + $arg += @("--macos-app-icon=textures/icon.png") # 编译器配置 $arg += @("--msvc=latest") $arg += @("--clang") @@ -109,8 +111,10 @@ jobs: $arg += @("--company-name=tool-shenjack-workshop") $arg += @("--product-name=Difficult-Rocket") $arg += @("--product-version=$env:DR_version") - $arg += @("--file-version=0.0.0.1") + $arg += @("--file-version=$env:Build_version") $arg += @("--file-description=Difficult-Rocket!") + $arg += @("--windows-icon-from-ico=textures/icon.png") + $arg += @("--macos-app-icon=textures/icon.png") # 编译器配置 $arg += @("--clang") $arg += @("--lto=no") diff --git a/nuitka1-complie.ps1 b/nuitka1-complie.ps1 index 3b0463e..68df06b 100644 --- a/nuitka1-complie.ps1 +++ b/nuitka1-complie.ps1 @@ -10,6 +10,8 @@ $arg += @("--product-name=Difficult-Rocket") $arg += @("--product-version=0.6.4") $arg += @("--file-version=0.0.0.1") $arg += @("--file-description=Difficult-Rocket!") +$arg += @("--windows-icon-from-ico=textures/icon.png") +$arg += @("--macos-app-icon=textures/icon.png") # 编译器配置 $arg += @("--mingw64") $arg += @("--clang") diff --git a/nuitka3-complie.ps1 b/nuitka3-complie.ps1 index e6db7dc..10877a3 100644 --- a/nuitka3-complie.ps1 +++ b/nuitka3-complie.ps1 @@ -10,6 +10,8 @@ $arg += @("--product-name=Difficult-Rocket") $arg += @("--product-version=0.6.4") $arg += @("--file-version=0.0.0.1") $arg += @("--file-description=Difficult-Rocket!") +$arg += @("--windows-icon-from-ico=textures/icon.png") +$arg += @("--macos-app-icon=textures/icon.png") # 编译器配置 $arg += @("--msvc=latest") $arg += @("--clang") diff --git a/pyproject.toml b/pyproject.toml index b505e79..f3008e7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,5 +22,5 @@ defusedxml = "*" [build-system] -requires = ["setuptools"] -build-backend = "poetry.core.masonry.api" +requires = ["setuptools>=42", "wheel", "nuitka", "toml", "imageio"] +build-backend = "nuitka.distutils.Build"