Update nuitka.yml

suppport macos

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

some manage

no need to test

Update nuitka.yml

Update post_compile.py

Update post_compile.py

ruaaaa

Update post_compile.py

离谱

aaaaa

Update nuitka.yml

my bad

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

我不理解

?????????

action崩了啊,那没事了

啊啊啊啊

恢复啦?

酱紫改?

Update nuitka.yml

Update nuitka.yml

草,为啥

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

这样的路径?

woshishabi

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

Update post_build.py

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

aaaaaa

Update nuitka.yml

Update nuitka.yml

Update setup.py

Update nuitka.yml

Update nuitka.yml

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

try copy

aaaaaa

Update nuitka.yml

Update nuitka.yml

Update nuitka.yml

like this?

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

Update post_compile.py

这么改?

Update post_compile.py

Update nuitka.yml

Update nuitka.yml
This commit is contained in:
shenjack 2023-03-02 13:28:48 +08:00
parent 28a0e2bd4f
commit e16a286fe3
10 changed files with 110 additions and 37 deletions

View File

@ -16,6 +16,8 @@ args = ['-env', '-github-dev']
# print(sys.argv)
if sys.argv == [__file__]: # 没有输入参数,直接输出默认信息并输出
print(sys.version)
from Difficult_Rocket.utils import tools

View File

@ -49,7 +49,15 @@ jobs:
python-version: ${{ matrix.python-version }} # 为了支持 win7 我还是得用 3.8
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
cache: 'pip'
cache-dependency-path: '**/requirement-dev.txt'
cache-dependency-path: |
**/requirement-dev.txt
.github/workflows/requirement.txt
# 安装 Rust
# - name: Setup | Rust
# uses: ATiltedTree/setup-rust@v1
# with:
# rust-version: nightly
# 安装依赖
- name: Install env
@ -58,7 +66,11 @@ jobs:
# 使用 ruff 检查一遍仓库
- name: Ruff check
uses: jpetrucciani/ruff-check@main
if: runner.os == 'Windows' && matrix.python-version == '3.8'
# 只在 windows 的 python 3.8 上检查 减少无用报错
run: |
pip install ruff
ruff check . --exit-zero --format github
# 提取 DR 版本和其他信息
- name: Display Difficult-Rocket info
@ -78,7 +90,6 @@ jobs:
python post_build.py
python setup.py clean
cd ..
# Remove-Item ./src -Recurse
cd ..
cd ..
@ -103,10 +114,10 @@ jobs:
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
# $arg += @("--nofollow-import-to=objprint,pillow,cffi,PIL,pyglet")
$arg += @("--nofollow-import-to=libs.Difficult_Rocket_rs")
# 数据配置
$arg += @("--include-data-dir=./libs/pyglet=./pyglet")
$arg += @("--include-data-dir=./libs/fonts=./libs/fonts")
# $arg += @("--include-data-dir=./libs/fonts=./libs/fonts")
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
# 编译配置
@ -133,10 +144,10 @@ jobs:
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
# $arg += @("--nofollow-import-to=objprint,pillow,PIL,pyglet")
$arg += @("--nofollow-import-to=libs.Difficult_Rocket_rs")
# 数据配置
$arg += @("--include-data-dir=./libs/pyglet=./pyglet")
$arg += @("--include-data-dir=./libs/fonts=./libs/fonts")
# $arg += @("--include-data-dir=./libs/fonts=./libs/fonts")
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
# 编译配置
@ -147,8 +158,16 @@ jobs:
- name: after build
shell: pwsh
run: |
Copy-Item .\libs\pyglet\ .\build\DR.dist -Recurse
Rename-Item ./build/DR.dist Difficult-Rocket
Get-ChildItem libs/fonts/Fira_Code -Recurse | Remove-Item -Force
Get-ChildItem libs/fonts/scientifica -Recurse | Remove-Item -Force
Remove-Item libs/fonts/Monocraft.otf -Force
Remove-Item libs/fonts/SmileySans-Oblique.ttf -Force
Get-ChildItem libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans_Condensed/* -Recurse | Remove-Item -Force
Get-ChildItem libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans/* -Recurse | Remove-Item -Force
Copy-Item libs/fonts build\DR.dist\libs\fonts -Recurse
Copy-Item libs\pyglet\ build\DR.dist -Recurse
# Copy-Item -Path "libs\Difficult_Rocket_rs\lib\*" -Destination "build\DR.dist\libs\Difficult_Rocket_rs\lib" -Recurse
Rename-Item build/DR.dist Difficult-Rocket
python ./.github/workflows/post_compile.py
# Uploads artifact

View File

@ -22,43 +22,75 @@ def make_zip():
dist_zip.write(file_path)
def show_files():
print("----------")
try:
print(os.listdir('libs'))
print(os.listdir('build'))
print(os.listdir('build/libs'))
print(os.listdir('build/libs/fonts'))
print(os.listdir("build/libs/Difficult_Rocket_rs"))
except Exception as e:
print(f'list file error {e}')
print('-----------')
def remove_un_use():
un_use_file = [
'./libs/fonts/Fira_Code',
'./libs/fonts/scientifica'
'./libs/fonts/Monocraft.otf',
'./libs/fonts/SmileySans-Oblique.ttf'
'./libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans_Condensed',
'./libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans'
'libs/fonts/Fira_Code',
'libs/fonts/scientifica',
'libs/fonts/Monocraft.otf',
'libs/fonts/SmileySans-Oblique.ttf',
'libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans_Condensed',
'libs/fonts/HarmonyOS_Sans/HarmonyOS_Sans',
]
# 删除不必要的文件
# 如果忽略不存在或无法删除的文件
os.chdir('./build/Difficult-Rocket')
for file in un_use_file:
print(os.listdir())
print(os.path.abspath(os.curdir))
print("=============")
for the_file in un_use_file:
print(f"file: {the_file}")
try:
os.remove(file)
except FileNotFoundError:
pass
os.remove(the_file)
shutil.rmtree(the_file, ignore_errors=True)
print(f"origin remove {the_file}")
except PermissionError:
pass
except IsADirectoryError:
print(f"Permission denied at {os.path.abspath(the_file)}")
except (IsADirectoryError, FileNotFoundError):
# 如果是目录
shutil.rmtree(file)
try:
shutil.rmtree(the_file)
print(f"remove dir {os.path.abspath(the_file)}")
except FileNotFoundError:
print(f"FileNotFoundError at {os.path.abspath(the_file)}")
print("=============")
os.chdir('../../')
def copy_data_file():
files = {
'./libs/pyglet': './build/pyglet',
'./libs/Difficult_Rocket_rs/lib': './build/libs/Difficult_Rocket_rs/lib',
'libs/pyglet': 'build/pyglet',
'libs/Difficult_Rocket_rs/lib': 'build/libs/Difficult_Rocket_rs/lib',
'libs/fonts': 'build/libs/fonts'
}
# 使用 shutil 复制文件
# os.mkdir("build/pyglet")
# os.mkdir("build/libs")
# os.mkdir("build/libs/Difficult_Rocket_rs")
# os.mkdir("build/libs/Difficult_Rocket_rs/lib")
for src, dist in files.items():
shutil.copytree(src, dist)
try:
shutil.copytree(src, dist)
except Exception as e:
print(f"error: {e}")
if __name__ == '__main__':
print(os.listdir('./build'))
show_files()
remove_un_use()
show_files()
copy_data_file()
show_files()
make_zip()

2
.github/workflows/requirement.txt vendored Normal file
View File

@ -0,0 +1,2 @@
# for checker
ruff >= 0.0.253

View File

@ -23,7 +23,7 @@ from Difficult_Rocket.api.types import Options
from libs.MCDR.version import Version
game_version = Version("0.7.1.4") # 游戏版本
build_version = Version("1.2.0.0") # 编译文件版本(与游戏本体无关)
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
DR_rust_version = Version("0.2.5.5") # DR 的 Rust 编写部分的版本
Api_version = Version("0.0.0.1") # API 版本
__version__ = game_version
@ -80,8 +80,7 @@ class _DR_option(Options):
if sys.platform != 'darwin': # MacOS 的测试只能在 Macos 上跑
self.pyglet_macosx_dev_test = False
try:
from libs.Difficult_Rocket_rs import test_call, get_version_str, part_list_read_test
part_list_read_test("./configs/PartList.xml")
from libs.Difficult_Rocket_rs import test_call, get_version_str
test_call(self)
print(f'DR_rust available: {get_version_str()}')
except ImportError:
@ -91,6 +90,11 @@ class _DR_option(Options):
self.use_DR_rust = self.use_DR_rust and self.DR_rust_available
self.flush_option()
def test_rust(self):
if self.DR_rust_available:
from libs.Difficult_Rocket_rs import part_list_read_test
part_list_read_test("./configs/PartList.xml")
def draw(self):
self.DR_rust_available = True

View File

@ -22,7 +22,13 @@
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
- Using [SemVer 2.0.0](https://semver.org/) to manage version
## 20230302 DR `0.7.1.5` + Build `1.2.0.0`
## 20230302 DR `0.7.1.5` + Build `1.2.1.0`
WORKING ON
### Build V 1.2.1.0
- Actions 崩溃了 等等吧
### Build V 1.2.0.0

View File

@ -38,7 +38,4 @@ for build_dir in builds:
print(os.listdir(lib_path))
traceback.print_exc()
continue
# os.remove(file_name)
# shutil.copy(os.path.join(build_path, build_dir, package_path, file), file_name)
# shutil.rmtree(os.path.join(build_path, build_dir))
# print(os.path.join(build_path, build_dir))
print(os.path.abspath(file_name))

View File

@ -3,12 +3,14 @@
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import os
import sys
import shutil
from setuptools import setup
from setuptools_rust import Binding, RustExtension
sys.path.append('../../../')
sys.path.append(os.curdir)
if '../../../' in sys.path:
from Difficult_Rocket import DR_runtime
@ -29,7 +31,6 @@ lib_path = '../lib'
build_path = 'build'
if 'clean' in sys.argv:
shutil.rmtree(lib_path, ignore_errors=True)
shutil.rmtree(build_path, ignore_errors=True)
shutil.rmtree(f'{package_path}.egg-info', ignore_errors=True)
sys.exit(0)

View File

@ -340,9 +340,18 @@ pub mod part_list {
if let Some(parts) = _parts {
// println!("{:?}", parts)
parts.list_print();
let part_list = parts.to_sr_part_list(Some("Vanilla".to_string()));
let _part_list = parts.to_sr_part_list(Some("Vanilla".to_string()));
}
// read_part_list(file_name);
Ok(())
}
}
}
#[allow(unused)]
pub mod ship {
use pyo3::prelude::*;
use serde::{Serialize, Deserialize};
// use quick_xml::de::from_str;
use serde_xml_rs::{from_str};
}

View File

@ -32,6 +32,7 @@ $arg += @("--windows-icon-from-ico=textures/icon.png")
$arg += @("--msvc=latest")
$arg += @("--clang")
$arg += @("--lto=no")
$arg += @("--nofollow-import-to=libs.Difficult_Rocket_rs")
# 数据配置
$arg += @("--include-data-dir=./libs/pyglet=./libs/pyglet")
$arg += @("--include-data-dir=./libs/fonts=./libs/fonts")