From df3837533f17e1bbe0015c0ced0f7ef4d2732146 Mon Sep 17 00:00:00 2001 From: GT-Zhang <1029550448@qq.com> Date: Sun, 26 Nov 2023 23:00:44 +0800 Subject: [PATCH] V1.0b7 Release! --- qpt/executor.py | 12 ++++++++---- qpt/ext/launcher/compatibility_mode.cmd | 6 +++--- qpt/ext/launcher_debug/compatibility_mode.cmd | 3 +-- qpt/kernel/qinterpreter.py | 3 ++- qpt/kernel/qos.py | 7 ++++--- qpt/memory.py | 4 ++-- qpt/modules/python_env.py | 6 +++--- qpt/version.py | 2 +- setup.py | 3 ++- 9 files changed, 26 insertions(+), 20 deletions(-) diff --git a/qpt/executor.py b/qpt/executor.py index 6af0b1d..203e313 100644 --- a/qpt/executor.py +++ b/qpt/executor.py @@ -285,7 +285,7 @@ def make(self): dst=os.path.join(self.debug_path, "configs/entry.cmd")) # 注册主程序文件路径 with open(os.path.join(self.debug_path, "configs/entry.cmd"), "r", encoding="utf-8") as f: - data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=" + self.launcher_py_path[0]) + data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=resources/" + self.launcher_py_path[0]) with open(os.path.join(self.debug_path, "configs/entry.cmd"), "w", encoding="utf-8") as f: f.write(data) @@ -296,7 +296,7 @@ def make(self): # 重命名兼容模式文件 compatibility_mode_file = os.path.join(self.debug_path, "compatibility_mode.cmd") with open(os.path.join(self.debug_path, "compatibility_mode.cmd"), "r", encoding="utf-8") as f: - data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=" + self.launcher_py_path[0]) + data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=resources/" + self.launcher_py_path[0]) with open(os.path.join(self.debug_path, "compatibility_mode.cmd"), "w", encoding="utf-8") as f: f.write(data) if os.path.exists(compatibility_mode_file): @@ -318,13 +318,17 @@ def make(self): dst=os.path.join(self.module_path, "configs/entry.cmd")) # 注册主程序文件路径 with open(os.path.join(self.module_path, "configs/entry.cmd"), "r", encoding="utf-8") as f: - data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=" + self.launcher_py_path[0]) + data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=resources/" + self.launcher_py_path[0]) with open(os.path.join(self.module_path, "configs/entry.cmd"), "w", encoding="utf-8") as f: f.write(data) copytree(launcher_ext_dir, dst=self.module_path, ignore_files=launcher_ignore_file) # 重命名兼容模式文件 compatibility_mode_file = os.path.join(self.module_path, "compatibility_mode.cmd") + with open(compatibility_mode_file, "r", encoding="utf-8") as f: + data = f.read().replace("QPT_PY_MAIN_FILE=NONE", "QPT_PY_MAIN_FILE=resources/" + self.launcher_py_path[0]) + with open(compatibility_mode_file, "w", encoding="utf-8") as f: + f.write(data) if os.path.exists(compatibility_mode_file): os.rename(compatibility_mode_file, os.path.join(self.module_path, "使用兼容模式运行.cmd")) @@ -511,5 +515,5 @@ def run(self): else: CheckRun.make_run_file(self.config_path) - os.chdir(self.work_dir) + # os.chdir(self.work_dir) Logging.info("环境部署完毕!") diff --git a/qpt/ext/launcher/compatibility_mode.cmd b/qpt/ext/launcher/compatibility_mode.cmd index 0fd7d7e..4bb222f 100644 --- a/qpt/ext/launcher/compatibility_mode.cmd +++ b/qpt/ext/launcher/compatibility_mode.cmd @@ -1,15 +1,15 @@ echo on chcp 65001 cd /d %~dp0 -cd .. + set QPT_COLOR=False set QPT_MODE=Debug set PYTHONUNBUFFERED=1 set PYTHONIOENCODING=utf-8 +set PROMPT=(QPT_VENV) %PROMPT% set QPT_PY_MAIN_FILE=NONE -set QPT_ARGS=%1 -"./Python/python.exe" %QPT_PY_MAIN_FILE%%QPT_ARGS:QPT_ARGS_FLAG= % +"./Python/python.exe" %QPT_PY_MAIN_FILE% %* echo 当前程序已执行结束,任意键后将进行关闭本程序。 pause diff --git a/qpt/ext/launcher_debug/compatibility_mode.cmd b/qpt/ext/launcher_debug/compatibility_mode.cmd index 79f3a5b..b9dc346 100644 --- a/qpt/ext/launcher_debug/compatibility_mode.cmd +++ b/qpt/ext/launcher_debug/compatibility_mode.cmd @@ -8,8 +8,7 @@ set PYTHONIOENCODING=utf-8 set PROMPT=(QPT_VENV) %PROMPT% set QPT_PY_MAIN_FILE=NONE -set QPT_ARGS=%1 -"./Python/python.exe" %QPT_PY_MAIN_FILE%%QPT_ARGS:QPT_ARGS_FLAG= % +"./Python/python.exe" %QPT_PY_MAIN_FILE% %* cls pause diff --git a/qpt/kernel/qinterpreter.py b/qpt/kernel/qinterpreter.py index 43bfc25..e144434 100644 --- a/qpt/kernel/qinterpreter.py +++ b/qpt/kernel/qinterpreter.py @@ -14,8 +14,9 @@ BAIDU_PIP_SOURCE = "https://mirror.baidu.com/pypi/simple" DOUBAN_PIP_SOURCE = "https://pypi.douban.com/simple" BFSU_PIP_SOURCE = "https://mirrors.bfsu.edu.cn/pypi/web/simple" +ALIYUN_PIP_SOURCE = "https://mirrors.aliyun.com/pypi/simple" PYPI_PIP_SOURCE = "https://pypi.python.org/simple" -DEFAULT_PIP_SOURCE = BFSU_PIP_SOURCE +DEFAULT_PIP_SOURCE = ALIYUN_PIP_SOURCE # DEFAULT_PIP_SOURCE = DOUBAN_PIP_SOURCE SIGNALS = ["=", "~", "<", ">"] diff --git a/qpt/kernel/qos.py b/qpt/kernel/qos.py index cc48cf6..1dfd0c6 100644 --- a/qpt/kernel/qos.py +++ b/qpt/kernel/qos.py @@ -16,13 +16,14 @@ def check_and_install_sdk_in_this_env(name: str): """ 在当前环境下检查某个个SDK是否被安装,若安装则返回SDK目录,未安装则进行安装 :param: name - :return: SDK path + :return: QPT SDK 的绝对路径 """ sdk_list = QPT_MEMORY.get_qpt_sdk_list if name.lower() not in sdk_list: QPT_MEMORY.pip_tool_in_this_env.pip_package_shell(package=name) - import QPT_SDK - return os.path.abspath(os.path.join(os.path.dirname(QPT_SDK.__file__), name)) + from QPT_SDK.loc import QPT_SDK_PATH + + return QPT_SDK_PATH def update_all_sdk_in_this_env(): diff --git a/qpt/memory.py b/qpt/memory.py index 1f9ae48..3c70b91 100644 --- a/qpt/memory.py +++ b/qpt/memory.py @@ -92,8 +92,8 @@ def get_win32api(self): @init_wrapper() def get_qpt_sdk_list(self): - import QPT_SDK - path_list = os.listdir(os.path.dirname(QPT_SDK.__file__)) + from QPT_SDK.loc import QPT_SDK_PATH + path_list = os.listdir(QPT_SDK_PATH) sdk_list = [path.lower() for path in path_list if os.path.isdir(path)] return sdk_list diff --git a/qpt/modules/python_env.py b/qpt/modules/python_env.py index da3061a..fe3e78a 100644 --- a/qpt/modules/python_env.py +++ b/qpt/modules/python_env.py @@ -22,16 +22,16 @@ def act(self) -> None: # ToDo 增加版本控制 m = f"python{self.version}" path = check_and_install_sdk_in_this_env(f"QEnvPython{self.version}") - copytree(os.path.join(path, m), os.path.join(self.module_path, "Python")) + copytree(os.path.join(os.path.join(path, "QEnvPython"), m), os.path.join(self.module_path, "Python")) # ToDo 未来对Tinkter和VC2019进行分离,先暂时放一起 m = f"tkinter{self.version}" path = check_and_install_sdk_in_this_env(f"QEnvPython{self.version}") - copytree(os.path.join(path, m), os.path.join(self.module_path, "Python")) + copytree(os.path.join(os.path.join(path, "QEnvPython"), m), os.path.join(self.module_path, "Python")) m = "vcredist" path = check_and_install_sdk_in_this_env("QVCRedist") - copytree(os.path.join(path, m), os.path.join(self.module_path, "Python")) + copytree(os.path.join(os.path.join(path, "QVCRedist"), m), os.path.join(self.module_path, "Python")) class BasePythonEnv(SubModule): diff --git a/qpt/version.py b/qpt/version.py index 59e6680..10d8840 100644 --- a/qpt/version.py +++ b/qpt/version.py @@ -1 +1 @@ -version = "1.0b4.dev6" +version = "1.0b4.dev7" diff --git a/setup.py b/setup.py index f35ff3c..e9af933 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,8 @@ "pefile", "pillow", "toml", - "pip>=22.1.1"], + "pip>=23.1," + "QPT-SDK"], python_requires='>=3.8', include_package_data=True, entry_points={