From 1062ca87f702d0b8a192f3566aebe05983a94750 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Thu, 2 Mar 2023 13:15:29 +0800 Subject: [PATCH] Build Version 1.2.0.0 + typing --- .github/workflows/post_compile.py | 36 ++++++++++++++++++--- Difficult_Rocket/__init__.py | 2 +- Difficult_Rocket/api/exception/command.py | 10 +++++- Difficult_Rocket/api/exception/logger.py | 4 ++- Difficult_Rocket/api/exception/threading.py | 4 ++- Difficult_Rocket/api/exception/unsupport.py | 9 +++++- Difficult_Rocket/client/__init__.py | 1 + Difficult_Rocket/exception/language.py | 2 +- Difficult_Rocket/utils/tools.py | 2 +- Difficult_Rocket/utils/translate.py | 2 +- configs/PartList.xml | 2 +- docs/src/update_logs.md | 27 ++++++++++++++++ libs/utils/logger.py | 2 +- pyproject.toml | 4 +-- 14 files changed, 90 insertions(+), 17 deletions(-) diff --git a/.github/workflows/post_compile.py b/.github/workflows/post_compile.py index fc410f9..7044b89 100644 --- a/.github/workflows/post_compile.py +++ b/.github/workflows/post_compile.py @@ -7,6 +7,7 @@ import os import sys import zipfile +import shutil if sys.platform == "win32": os.system('') @@ -21,13 +22,40 @@ def make_zip(): dist_zip.write(file_path) -def remove_dev_usage(): - un_use_fonts = [ - './' +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') + for file in un_use_file: + try: + os.remove(file) + except FileNotFoundError: + pass + except PermissionError: + pass + os.chdir('../../') + + +def copy_data_file(): + files = { + './libs/pyglet': './build/pyglet', + './libs/Difficult_Rocket_rs/lib': './build/libs/Difficult_Rocket_rs/lib', + } + # 使用 shutil 复制文件 + for src, dist in files.items(): + shutil.copytree(src, dist) if __name__ == '__main__': print(os.listdir('./build')) + remove_un_use() + copy_data_file() make_zip() diff --git a/Difficult_Rocket/__init__.py b/Difficult_Rocket/__init__.py index 789657e..a85a962 100644 --- a/Difficult_Rocket/__init__.py +++ b/Difficult_Rocket/__init__.py @@ -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.1.0.0") # 编译文件版本(与游戏本体无关) +build_version = Version("1.2.0.0") # 编译文件版本(与游戏本体无关) DR_rust_version = Version("0.2.5.5") # DR 的 Rust 编写部分的版本 Api_version = Version("0.0.0.1") # API 版本 __version__ = game_version diff --git a/Difficult_Rocket/api/exception/command.py b/Difficult_Rocket/api/exception/command.py index b0f8008..7d0c59c 100644 --- a/Difficult_Rocket/api/exception/command.py +++ b/Difficult_Rocket/api/exception/command.py @@ -11,7 +11,15 @@ github: @shenjackyuanjie gitee: @shenjackyuanjie """ -from Difficult_Rocket.exception.command import * +from Difficult_Rocket.exception.command import ( + CommandError, + CommandParseError, + CommandQMarkPosError, + CommandQMarkConflict, + CommandQMarkMissing, + CommandQMarkPreMissing, + CommandQMarkSufMissing +) __all__ = [ "CommandError", diff --git a/Difficult_Rocket/api/exception/logger.py b/Difficult_Rocket/api/exception/logger.py index d46483a..8361e89 100644 --- a/Difficult_Rocket/api/exception/logger.py +++ b/Difficult_Rocket/api/exception/logger.py @@ -4,7 +4,9 @@ # All rights reserved # ------------------------------- -from Difficult_Rocket.exception.logger import * +from Difficult_Rocket.exception.logger import ( + LogFileLockTimeOutError +) __all__ = [ "LogFileLockTimeOutError" diff --git a/Difficult_Rocket/api/exception/threading.py b/Difficult_Rocket/api/exception/threading.py index d463501..c40ab54 100644 --- a/Difficult_Rocket/api/exception/threading.py +++ b/Difficult_Rocket/api/exception/threading.py @@ -4,7 +4,9 @@ # All rights reserved # ------------------------------- -from Difficult_Rocket.exception.threading import * +from Difficult_Rocket.exception.threading import ( + LockTimeOutError +) __all__ = [ "LockTimeOutError" diff --git a/Difficult_Rocket/api/exception/unsupport.py b/Difficult_Rocket/api/exception/unsupport.py index 3a3a199..f8d056c 100644 --- a/Difficult_Rocket/api/exception/unsupport.py +++ b/Difficult_Rocket/api/exception/unsupport.py @@ -11,7 +11,14 @@ github: @shenjackyuanjie gitee: @shenjackyuanjie """ -from Difficult_Rocket.exception.unsupport import * +from Difficult_Rocket.exception.unsupport import ( + NoMoreJson5, + Nope418ImATeapot, + ThinkError, + BrainError, + BigBrainError, + GrammarError +) __all__ = [ 'NoMoreJson5', diff --git a/Difficult_Rocket/client/__init__.py b/Difficult_Rocket/client/__init__.py index 2f834ec..4830e87 100644 --- a/Difficult_Rocket/client/__init__.py +++ b/Difficult_Rocket/client/__init__.py @@ -1,3 +1,4 @@ + # ------------------------------- # Difficult Rocket # Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com diff --git a/Difficult_Rocket/exception/language.py b/Difficult_Rocket/exception/language.py index 5b9d7c3..1b68ed2 100644 --- a/Difficult_Rocket/exception/language.py +++ b/Difficult_Rocket/exception/language.py @@ -4,7 +4,7 @@ # All rights reserved # ------------------------------- -from Difficult_Rocket.exception import BaseError, BaseRuntimeError +from Difficult_Rocket.exception import BaseError __all__ = ['LanguageNotFound', 'TranslateError', diff --git a/Difficult_Rocket/utils/tools.py b/Difficult_Rocket/utils/tools.py index 24ef3ae..7d2be64 100644 --- a/Difficult_Rocket/utils/tools.py +++ b/Difficult_Rocket/utils/tools.py @@ -36,7 +36,7 @@ file configs file_error = {FileNotFoundError: 'no {filetype} file was founded!:\n file name: {filename}\n file_type: {filetype}\n stack: {stack}', KeyError: 'no stack in {filetype} file {filename} was found! \n file type: {} \n file name: {} \n stack: {stack}', - Exception: 'get some {error_type} error when read {filetype} file {filename}! \n file type: {} \n file name: {} \n stack: {stack}'} + Exception: 'get some {error_type} when read {filetype} file {filename}! \n file type: {} \n file name: {} \n stack: {stack}'} def load_file(file_name: str, diff --git a/Difficult_Rocket/utils/translate.py b/Difficult_Rocket/utils/translate.py index 9c17bcc..03632de 100644 --- a/Difficult_Rocket/utils/translate.py +++ b/Difficult_Rocket/utils/translate.py @@ -14,7 +14,7 @@ gitee: @shenjackyuanjie import inspect from dataclasses import dataclass -from typing import Union, Tuple, Any, Type, List, Dict, Hashable, Optional +from typing import Union, Tuple, Any, List, Dict, Hashable, Optional from Difficult_Rocket import DR_runtime, DR_option from Difficult_Rocket.utils import tools diff --git a/configs/PartList.xml b/configs/PartList.xml index 187faab..84b474e 100644 --- a/configs/PartList.xml +++ b/configs/PartList.xml @@ -1,4 +1,4 @@ - +