Feature/python build #25

Merged
shenjackyuanjie merged 28 commits from feature/python_build into main 2023-06-10 19:02:01 +08:00
20 changed files with 211 additions and 384 deletions

View File

@ -8,10 +8,12 @@ on:
paths:
- "mods/dr_game/**" # 本体修改
- ".github/workflows/**" # workflow 修改
- "requirements*" # 依赖修改
pull_request:
paths:
- "mods/dr_game/**" # 本体修改
- ".github/workflows/**" # workflow 修改
- "requirements*" # 依赖修改
workflow_dispatch:
# 主任务

View File

@ -10,12 +10,16 @@ on:
- "configs/**" # 配置修改
- "libs/pyglet/**" # pyglet 修改
- ".github/workflows/**" # workflow 修改
- "nuitka_build.py" # 构建脚本修改
- "requirements*" # 依赖修改
pull_request:
paths:
- "Difficult_Rocket/**" # 本体修改
- "configs/**" # 配置修改
- "libs/pyglet/**" # pyglet 修改
- ".github/workflows/**" # workflow 修改
- "nuitka_build.py" # 构建脚本修改
- "requirements*" # 依赖修改
workflow_dispatch:
# 主任务
@ -39,20 +43,6 @@ jobs:
- name: Checkout code
uses: nschloe/action-cached-lfs-checkout@v1
# 获取短 sha
- name: Get short commit sha
id: get_short_sha
shell: pwsh
run: |
# short_sha=$(echo ${GITHUB_SHA} | cut -c1-7)
# echo "short_sha=$short_sha" >> $GITHUB_OUTPUT
# echo $GITHUB_OUTPUT
$short_sha = Write-Output $env:GITHUB_SHA
$short_sha = $short_sha.substring(1,7)
Write-Output $short_sha
Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV
# 安装 Python
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
@ -91,86 +81,35 @@ jobs:
Write-Output $infos >> $env:GITHUB_ENV
python .github/workflows/get_info.py
# 还是得我自己写脚本
- name: Build on Windows
if: runner.os == 'Windows'
# 使用新的 nuitka_build.py
- name: Build by nuitka
shell: pwsh
run: |
$arg = @()
# 输出配置
$arg += @("--standalone")
$arg += @("--output-dir=build")
$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 += @("--windows-icon-from-ico=textures/icon.png")
# $arg += @("--macos-app-icon=textures/icon.png")
# 编译器配置
$arg += @("--msvc=latest")
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
$arg += @("--nofollow-import-to=objprint,pillow,PIL,cffi")
$arg += @("--follow-import-to=pyglet")
# 数据配置
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
# 编译配置
$arg += @("--disable-ccache")
$arg += @("--assume-yes-for-download")
python -m nuitka $arg DR.py
python nuitka_build.py --github
# 集成的构建脚本 好耶!
- name: Build on MacOS / Linux
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
# 获取短 sha
- name: Get short commit sha
id: get_short_sha
shell: pwsh
run: |
$arg = @()
# 输出配置
$arg += @("--standalone")
$arg += @("--output-dir=build")
$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 += @("--windows-icon-from-ico=textures/icon.png")
$arg += @("--macos-app-icon=textures/icon.png")
# 编译器配置
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
$arg += @("--nofollow-import-to=objprint,pillow,PIL,cffi")
$arg += @("--follow-import-to=pyglet")
# 数据配置
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
# 编译配置
$arg += @("--disable-ccache")
$arg += @("--assume-yes-for-download")
python -m nuitka $arg DR.py
- name: after build
shell: pwsh
run: |
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
Rename-Item build/DR.dist Difficult-Rocket
python ./.github/workflows/post_compile.py
$short_sha = Write-Output $env:GITHUB_SHA
$short_sha = $short_sha.substring(1,7)
Write-Output $short_sha
Write-Output "short_sha=$short_sha" >> $env:GITHUB_ENV
# Uploads artifact
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Difficult-Rocket_v${{env.DR_version}}-${{runner.os}}${{matrix.python-version}}-Build.${{github.run_number}}+${{env.short_sha}}
name: Difficult-Rocket_v${{env.DR_version}}-${{runner.os}}${{matrix.python-version}}-Build.${{github.run_number}}+${{env.short_sha}}.zip
path: |
build/main.zip
build/github/DR.dist
# Uploads artifact
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Difficult-Rocket_v${{env.DR_version}}-${{runner.os}}${{matrix.python-version}}-Build.${{github.run_number}}+${{env.short_sha}}.zip.zip
path: |
build/Difficult_Rocket.zip

View File

@ -1,96 +0,0 @@
# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import os
import sys
import zipfile
import shutil
if sys.platform == "win32":
os.system('')
def make_zip():
with zipfile.ZipFile('./build/main.zip', 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as dist_zip:
for path, sub_paths, sub_files in os.walk('./build/Difficult-Rocket'):
print(f'writing {path}')
for file in sub_files:
file_path = os.path.join(path, file)
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',
]
# 删除不必要的文件
# 如果忽略不存在或无法删除的文件
os.chdir('./build/Difficult-Rocket')
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(the_file)
shutil.rmtree(the_file, ignore_errors=True)
print(f"origin remove {the_file}")
except PermissionError:
print(f"Permission denied at {os.path.abspath(the_file)}")
except (IsADirectoryError, FileNotFoundError):
# 如果是目录
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/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():
try:
shutil.copytree(src, dist)
except Exception as e:
print(f"error: {e}")
if __name__ == '__main__':
show_files()
remove_un_use()
show_files()
copy_data_file()
show_files()
make_zip()

View File

@ -1,5 +0,0 @@
# for checker
# ruff >= 0.0.253
# for dsm upload
synology-api >= 0.5.1

View File

@ -16,8 +16,8 @@ from Difficult_Rocket.api.types import Options
from libs.MCDR.version import Version
game_version = Version("0.8.0.0") # 游戏版本
build_version = Version("1.2.1.0") # 编译文件版本(与游戏本体无关)
game_version = Version("0.8.1.0") # 游戏版本
build_version = Version("1.3.0.0") # 编译文件版本(与游戏本体无关)
Api_version = Version("0.1.1.0") # API 版本
__version__ = game_version

View File

@ -20,7 +20,7 @@
[关于版本号的说明](./docs/src/version.md)
[![Generic badge](https://img.shields.io/badge/Release-0.8.0.0-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![Generic badge](https://img.shields.io/badge/Pre_Release-0.8.0.0-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![Generic badge](https://img.shields.io/badge/Pre_Release-0.8.0.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![Generic badge](https://img.shields.io/badge/Devloping-0.8.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![language badge](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)

View File

@ -1,20 +0,0 @@
$objects = git verify-pack -v .git/objects/pack/pack-aba4bfc55979194c86dbd466c86e57d8199ae7ad.idx | Select-String -Pattern 'chain' -NotMatch | ForEach-Object {$_.Line} | Sort-Object -Property @{Expression={$_.Split(" ")[2]}; Ascending=$false} | Select-Object -First 50
Write-Output "All sizes are in kB. The pack column is the size of the object, compressed, inside the pack file."
$output = "size,pack,SHA,location"
foreach ($y in $objects) {
# extract the size in bytes
$size = [int]($y.Split(" ")[4]/1024)
# extract the compressed size in bytes
$compressedSize = [int]($y.Split(" ")[5]/1024)
# extract the SHA
$sha = $y.Split(" ")[0]
# find the objects location in the repository tree
$other = git rev-list --all --objects | Select-String $sha
$output += "`n${size},${compressedSize},${other}"
}
Write-Output $output | ConvertFrom-Csv -Delimiter "," | Format-Table
Pause

View File

@ -1,27 +0,0 @@
#!/bin/bash
#set -x
IFS=$'\n';
# 默认值是 10个 可以一次性展示更多 就修改第15行代码 | head -n 30 或者更多
objects=`git verify-pack -v .git/objects/pack/pack-aba4bfc55979194c86dbd466c86e57d8199ae7ad.idx | grep -v chain | sort -k3nr | head -n 50`
echo "All sizes are in kB. The pack column is the size of the object, compressed, inside the pack file."
output="size,pack,SHA,location"
for y in $objects
do
# extract the size in bytes
size=$((`echo $y | cut -f 5 -d ' '`/1024))
# extract the compressed size in bytes
compressedSize=$((`echo $y | cut -f 6 -d ' '`/1024))
# extract the SHA
sha=`echo $y | cut -f 1 -d ' '`
# find the objects location in the repository tree
other=`git rev-list --all --objects | grep $sha`
#lineBreak=`echo -e "\n"`
output="${output}\n${size},${compressedSize},${other}"
done
echo -e $output | column -t -s ', '
pause

View File

@ -20,7 +20,7 @@
[About Versions](src/version.md)
[![Generic badge](https://img.shields.io/badge/Release-0.8.0.0-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![Generic badge](https://img.shields.io/badge/Pre_Release-0.8.0.0-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![Generic badge](https://img.shields.io/badge/Pre_Release-0.8.0.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![Generic badge](https://img.shields.io/badge/Devloping-0.8.1-blue.svg)](https://github.com/shenjackyuanjie/Difficult-Rocket/releases)
[![language badge](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)](https://stats.deeptrain.net/repo/shenjackyuanjie/Difficult-Rocket?theme=dark)
@ -42,20 +42,21 @@
## Environment (been tested / developed on)
- `Develop platform 1 - Windows 10 x64 22H2`
- Python `3.8.10`
- pillow `9.5.0`
- psutil `5.9.5`
- rtoml `0.9.0`
- tomlkit `0.11.7`
- tomlkit `0.11.8`
- defusedxml `0.7.1`
- objprint `0.2.2`
- viztracer `0.15.6`
- vizplugins `0.1.3`
- nuitka `1.5.6`
- nuitka `1.6.1`
- ordered-set `4.1.0`
- imageio `2.27.0`
- imageio `2.31.0`
- wheel `0.40.0`
- setuptools `67.6.1`
- setuptools-rust `1.5.2`
- setuptools `67.8.0`
- setuptools-rust `1.6.0`
- `AMD R5 5600X`
- `AMD RX 550 4G`

View File

@ -0,0 +1,17 @@
# DR 构建 更新日志
- 最新构建版本号
- build_version: 1.3.0.0
## 20230609 build 2.0.0.0
### Breaking Change
- 将构建脚本生成方式改为通过 `libs/utils/nuitka.py` 生成
-
## 202306 build 1.3.0.0
- 修改
- 向 `bifollow-import-to` 添加 `pydoc`

View File

@ -15,3 +15,7 @@
- `api.types`
- 添加 `Version` (`libs.MCDR.version.Version`)
### 修复 Bug
- 自带的 `console` 类在 `get_command` 时 没有检查是否为空

View File

@ -13,29 +13,41 @@ from typing import List, Tuple
from Difficult_Rocket.api.types import Options, Version
class Status(Options):
name = 'Nuitka Build Status'
class CompilerHelper(Options):
name = 'Nuitka Compiler Helper'
output_path: Path = Path("./build/nuitka")
output_path: Path = Path("./build/nuitka-win")
src_file: Path = Path('DR.py')
python_cmd: str = 'python'
# 以下为 nuitka 的参数
use_lto: bool = False # --lto=yes (no is faster)
use_clang: bool = True # --clang
use_msvc: bool = True # --msvc=latest
use_mingw: bool = False # --mingw64
standalone: bool = True # --standalone
use_ccache: bool = True # not --disable-ccache
show_progress: bool = True # --show-progress
show_memory: bool = False # --show-memory
download_confirm: bool = True # --assume-yes-for-download
company_name: str = 'tool-shenjack-workshop'
product_name: str = 'Difficult-Rocket'
product_version: Version
file_version: Version
icon_path: Path = Path('textures/icon.png')
follow_import: List[str] = ['pyglet', 'Difficult_Rocket.api']
no_follow_import: List[str] = ['objprint', 'pillow', 'PIL', 'cffi', 'pydoc']
include_data_dir: List[Tuple[Path, Path]] = [(Path('./libs/fonts'), Path('./libs/fonts')),
(Path('./textures'), Path('./textures')),
(Path('./configs'), Path('./configs'))]
include_packages: List[str] = []
follow_import: List[str] = ['pyglet']
no_follow_import: List[str] = ['objprint', 'pillow', 'PIL', 'cffi', 'pydoc', 'numpy']
include_data_dir: List[Tuple[str, str]] = [('./libs/fonts', './libs/fonts'),
('./textures', './textures'),
('./configs', './configs')]
include_packages: List[str] = ['Difficult_Rocket.api']
def init(self, **kwargs) -> None:
# 非 windows 平台不使用 msvc
@ -65,7 +77,7 @@ class Status(Options):
return f"{front}\n\n```bash\n{' '.join(gen_cmd)}\n```"
def gen_subprocess_cmd(self) -> List[str]:
cmd_list = ['python', '-m', 'nuitka']
cmd_list = [self.python_cmd, '-m', 'nuitka']
# macos 和 非 macos icon 参数不同
icon_cmd = ""
if platform.system() == 'Darwin':
@ -77,20 +89,37 @@ class Status(Options):
cmd_list.append('--lto=yes')
else:
cmd_list.append('--lto=no')
if self.use_clang:
cmd_list.append('--clang')
if self.use_msvc:
cmd_list.append('--msvc=latest')
if self.standalone:
cmd_list.append('--standalone')
if not self.use_ccache:
cmd_list.append('--disable-ccache')
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')
cmd_list.append(f"--output-dir={self.output_path.absolute()}")
cmd_list.append(f"--company-name={self.company_name}")
cmd_list.append(f"--product-name={self.product_name}")
cmd_list.append(f"--product-version={self.product_version}")
cmd_list.append(f"--file-version={self.file_version}")
cmd_list += icon_cmd
cmd_list += [f"--include-data-file={src}={dst}" for src, dst in self.include_data_dir]
if icon_cmd:
cmd_list.append(icon_cmd)
cmd_list += [f"--include-data-dir={src}={dst}" for src, dst in self.include_data_dir]
cmd_list += [f"--include-package={package}" for package in self.include_packages]
cmd_list.append(f"--follow-import-to={','.join(self.follow_import)}")
cmd_list.append(f"--nofollow-import-to={','.join(self.no_follow_import)}")
cmd_list.append(f"{self.src_file}")
return cmd_list

View File

@ -1,48 +0,0 @@
$start_time = Get-Uptime
Write-Output $start_time
python3 .github/workflows/get_info.py -env
if (-Not (Test-Path -Path "./.github/workflows/env.ps1"))
{
Throw "No env file found as ./github/workflows/env.ps1 !"
}
./.github/workflows/env.ps1
$arg = @()
# 输出配置
$arg += @("--standalone")
$arg += @("--output-dir=build/nuitka-mac")
$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 += @("--macos-app-icon=textures/icon.png")
# 编译器配置
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
$arg += @("--nofollow-import-to=objprint,pillow,PIL,cffi,pydoc")
$arg += @("--follow-import-to=pyglet")
# 数据配置
$arg += @("--include-data-dir=./libs/fonts=./libs/fonts")
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
$arg += @("--include-package=Difficult_Rocket.api")
# 编译配置
$arg += @("--show-memory")
$arg += @("--show-progress")
python3.9 -m nuitka $arg $args DR.py
$end_time = Get-Uptime
$out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s
Write-Output $start_time $end_time
Write-Output "--clang --lto=no and ($args)"
# --include-data-dir=./libs/pyglet=./pyglet
# --run
# --disable-ccache

View File

@ -1,49 +0,0 @@
$start_time = Get-Uptime
Write-Output $start_time
python .\.github\workflows\get_info.py -env
if (-Not (Test-Path -Path "./.github/workflows/env.ps1"))
{
Throw "No env file found as ./github/workflows/env.ps1 !"
}
./.github/workflows/env.ps1
$arg = @()
# 输出配置
$arg += @("--standalone")
$arg += @("--output-dir=build/nuitka-win")
$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 += @("--windows-icon-from-ico=textures/icon.png")
#$arg += @("--macos-app-icon=textures/icon.png")
# 编译器配置
$arg += @("--msvc=latest")
$arg += @("--clang")
$arg += @("--lto=no")
# 包配置
$arg += @("--nofollow-import-to=objprint,pillow,PIL,cffi,pydoc")
$arg += @("--follow-import-to=pyglet")
# 数据配置
$arg += @("--include-data-dir=./libs/fonts=./libs/fonts")
$arg += @("--include-data-dir=./textures=./textures")
$arg += @("--include-data-dir=./configs=./configs")
$arg += @("--include-package=Difficult_Rocket.api")
# 编译配置
$arg += @("--show-memory")
$arg += @("--show-progress")
python3.8.exe -m nuitka $arg $args DR.py
$end_time = Get-Uptime
$out = $end_time.TotalMilliseconds - $start_time.TotalMilliseconds
Write-Output $end_time.TotalSeconds $start_time.TotalSeconds $out s
Write-Output $start_time $end_time
Write-Output "--clang --msvc=latest --lto=no and $args"
# --include-data-dir=./libs/pyglet=./pyglet
# --run
# --disable-ccache

86
nuitka_build.py Normal file
View File

@ -0,0 +1,86 @@
# -------------------------------
# Difficult Rocket
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
# All rights reserved
# -------------------------------
import os
import sys
import time
import shutil
import zipfile
import traceback
import subprocess
from pathlib import Path
from libs.utils import nuitka
if __name__ == '__main__':
compiler = nuitka.CompilerHelper()
# 修改 python 执行文件 为 运行时的 python
compiler.python_cmd = sys.executable
# 检测 --github 参数
is_github = False
if '--github' in sys.argv:
is_github = True
compiler.use_ccache = False
compiler.show_progress = False
compiler.output_path = Path('./build/github')
compiler.python_cmd = 'python'
# 检测 --output xx 参数
if '--output' in sys.argv:
# 输入的是输出目录
compiler.output_path = sys.argv[sys.argv.index('--output') + 1]
sys.argv.remove('--output')
sys.argv.remove(compiler.output_path)
print(compiler.output_path)
print(compiler)
print(compiler.gen_subprocess_cmd())
# 确认是否需要编译
# 如果包含 -y 参数 则直接编译
if (('-y' or '-n') not in sys.argv) and (not is_github):
while (do_compile := input('Do you want to compile this file? (y/n) ')) not in ['y', 'n']:
pass
elif '-y' in sys.argv:
do_compile = 'y'
elif is_github:
do_compile = 'y'
else:
do_compile = 'n'
if do_compile == 'y':
# 编译
time.sleep(1) # 等待 1s
start_time = time.time_ns()
subprocess.run(compiler.gen_subprocess_cmd())
print('Compile Done!')
print(f'Compile Time: {time.time_ns() - start_time} ns ({(time.time_ns() - start_time) / 1000_000_000} s)')
if is_github:
# 去除无用字体文件
try:
shutil.rmtree(compiler.output_path / 'DR.dist/libs/fonts' / 'Fira_Code', ignore_errors=True)
shutil.rmtree(compiler.output_path / 'DR.dist/libs/fonts' / 'scientifica', ignore_errors=True)
shutil.rmtree(compiler.output_path / 'DR.dist/libs/fonts' / 'HarmonyOS_Sans' / 'HarmonyOS_Sans_Condensed', ignore_errors=True)
shutil.rmtree(compiler.output_path / 'DR.dist/libs/fonts' / 'HarmonyOS_Sans' / 'HarmonyOS_Sans', ignore_errors=True)
os.remove(compiler.output_path / 'DR.dist/libs/fonts' / 'Monocraft.otf')
os.remove(compiler.output_path / 'DR.dist/libs/fonts' / 'SmileySans-Oblique.ttf')
except Exception:
traceback.print_exc()
print('Remove Useless Files Done!')
# 压缩
with zipfile.ZipFile(Path('./build/Difficult_Rocket.zip'), 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as dist_zip:
for path, sub_paths, sub_files in os.walk(compiler.output_path / 'DR.dist'):
print(f'writing {path}')
for file in sub_files:
file_path = os.path.join(path, file)
dist_zip.write(file_path)
print('Zip Done!')
sys.exit(0)

View File

@ -1,6 +0,0 @@
allPython.ps1 -m compileall 'libs\'
allPython.ps1 -m compileall 'Difficult_Rocket\'
allPython.ps1 -O -m compileall 'libs\'
allPython.ps1 -O -m compileall 'Difficult_Rocket\'
allPython.ps1 -OO -m compileall 'libs\'
allPython.ps1 -OO -m compileall 'Difficult_Rocket\'

View File

@ -6,7 +6,7 @@ build-backend = "pdm.pep517.api"
[project]
name = "difficult-rocket"
version = "0.8.0.0"
version = "0.8.1.0"
description = "A rocket game"
authors = [
{name = "shenjackyuanjie", email = "3695888@qq.com"}

View File

@ -10,16 +10,16 @@ psutil >= 5.9.5
# for files
rtoml >= 0.9.0
tomlkit >= 0.11.7
tomlkit >= 0.11.8
defusedxml >= 0.7.1
# for report error
objprint >= 0.2.2
# for compile
nuitka >= 1.5.6
nuitka >= 1.6.1
ordered-set >= 4.1.0
imageio >= 2.27.0
imageio >= 2.31.0
wheel >= 0.40.0
setuptools >= 67.6.1
setuptools-rust >= 1.5.2
setuptools >= 67.8.0
setuptools-rust >= 1.6.0

View File

@ -11,7 +11,7 @@ psutil >= 5.9.5
# for files
rtoml >= 0.9.0
tomlkit >= 0.11.7
tomlkit >= 0.11.8
defusedxml >= 0.7.1
# for debug
@ -20,9 +20,9 @@ viztracer >= 0.15.6
vizplugins >= 0.1.3
# for compile
nuitka >= 1.5.6
nuitka >= 1.6.1
ordered-set >= 4.1.0
imageio >= 2.27.0
imageio >= 2.31.0
wheel >= 0.40.0
setuptools >= 67.6.1
setuptools-rust >= 1.5.2
setuptools >= 67.8.0
setuptools-rust >= 1.6.0

View File

@ -9,7 +9,7 @@ psutil >= 5.9.5
# for files
rtoml >= 0.9.0
tomlkit >= 0.11.7
tomlkit >= 0.11.8
defusedxml >= 0.7.1
# for report error