Skip to content

Commit 2be2bed

Browse files
authored
Merge pull request #10 from muziing/dev
Version `0.1.13`
2 parents 7f834e4 + 3e65dc1 commit 2be2bed

33 files changed

Lines changed: 2995 additions & 784 deletions

dev_scripts/build.py

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@
1212
check_version_num,
1313
)
1414
from dev_scripts.clear_cache import clear_pycache, clear_pyinstaller_dist
15-
from dev_scripts.path_constants import README_FILE_LIST, RESOURCES_PATH, SRC_PATH
16-
17-
# TODO 加入日志模块,保存构建日志
15+
from dev_scripts.path_constants import (
16+
PROJECT_ROOT,
17+
README_FILE_LIST,
18+
RESOURCES_PATH,
19+
SRC_PATH,
20+
)
1821

1922

2023
def process_md_images(md_file_list: list[Path]) -> None:
@@ -49,7 +52,7 @@ def compile_resources() -> int:
4952
:return: rcc 进程返回码
5053
"""
5154

52-
compiled_file_path = RESOURCES_PATH / "compiled_resources.py"
55+
compiled_file_path = RESOURCES_PATH / "COMPILED_RESOURCES.py"
5356
qrc_file_path = RESOURCES_PATH / "resources.qrc"
5457
cmd = [
5558
"pyside6-rcc",
@@ -62,6 +65,25 @@ def compile_resources() -> int:
6265
return result.returncode
6366

6467

68+
def export_requirements() -> int:
69+
"""
70+
将项目依赖项导出至 requirements.txt 中
71+
:return: poetry export 命令返回值
72+
"""
73+
74+
poetry_export_cmd = [
75+
"poetry",
76+
"export",
77+
"--without-hashes",
78+
"-o",
79+
PROJECT_ROOT / "requirements.txt",
80+
"--format=requirements.txt",
81+
]
82+
result = subprocess.run(poetry_export_cmd)
83+
print(f"已将当前项目依赖导出至 requirements.txt,poetry export 返回码:{result.returncode}")
84+
return result.returncode
85+
86+
6587
def build_py2exe_gui() -> None:
6688
"""
6789
构建项目的总函数 \n
@@ -73,6 +95,7 @@ def build_py2exe_gui() -> None:
7395
clear_pycache(SRC_PATH)
7496
process_md_images(README_FILE_LIST)
7597
# compile_resources()
98+
export_requirements()
7699
print(f"pre-commit 检查完毕,返回码:{check_pre_commit()}。")
77100
print(f"mypy 检查完毕,返回码:{check_mypy()}。")
78101

@@ -86,6 +109,7 @@ def build_py2exe_gui() -> None:
86109

87110

88111
if __name__ == "__main__":
89-
# compile_resources()
90112
# process_md_images()
113+
# compile_resources()
114+
# export_requirements()
91115
build_py2exe_gui()

dev_scripts/check_funcs.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -103,17 +103,8 @@ def check_mypy() -> int:
103103
return result.returncode
104104

105105

106-
def check_requirements() -> int:
107-
"""
108-
检查 requirements.txt 中的依赖是否最新
109-
"""
110-
111-
pass
112-
113-
114106
if __name__ == "__main__":
115107
check_license_statement()
116108
check_version_num()
117109
check_pre_commit()
118110
check_mypy()
119-
check_requirements()

dev_scripts/path_constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
SRC_PATH = PROJECT_ROOT / "src" # 源码目录
1010
SRC_PKG_PATH = SRC_PATH / "py2exe_gui"
1111
RESOURCES_PATH = SRC_PKG_PATH / "Resources" # 静态资源文件目录
12-
COMPILED_RESOURCES = RESOURCES_PATH / "compiled_resources.py" # 编译静态资源文件
12+
COMPILED_RESOURCES = RESOURCES_PATH / "COMPILED_RESOURCES.py" # 编译静态资源文件
1313
README_FILE_LIST = [
1414
PROJECT_ROOT / "README.md",
1515
PROJECT_ROOT / "README_zh.md",

docs/ROADMAP.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@
1515
- [ ] Python 解释器选择器
1616
- [ ] 文件浏览对话框选择解释器可执行文件
1717
- [ ] 处理解释器验证器返回结果,异常时弹出对话框要求用户自行检查确认
18-
- [ ] 创建「解释器环境类」,保存解释器路径等信息
19-
- [ ] ComboBox 中列出各解释器,将解释器环境类保存在userData中
18+
- [x] 创建「解释器环境类」,保存解释器路径等信息
19+
- [x] ComboBox 中列出各解释器,将解释器路径保存在userData中
2020
- [ ] 快捷显示已安装的 `PyInstaller` 版本,未安装则提供「一键安装」
2121
- [ ] (?) 识别系统解释器/venv/Poetry/conda等
22-
- [ ] 命令浏览器
22+
- [x] 命令浏览器
2323
- [x] 显示将传递给 PyInstaller 的选项列表
2424
- [x] 高亮提示
2525
- [x] 以终端命令格式显示完整命令,并添加续行符
26+
- [ ] 导出为脚本功能,根据运行时平台导出 bash、powershell 等格式脚本
2627
- [ ] "What is this" 提示
2728
- [ ] 右键菜单,添加指向对应 PyInstaller 文档,提供完整帮助信息
2829
- [ ] `PyInstaller` 选项参数详解表格
@@ -42,7 +43,7 @@
4243
- [ ] 打包任务
4344
- [x] 创建打包任务,保存所有选项
4445
- [ ] 创建 [`.spec` 文件](https://pyinstaller.org/en/stable/spec-files.html)
45-
- [ ] `spec` 编辑器
46+
- [ ] ~~`spec` 编辑器~~
4647

4748
## 界面
4849

@@ -53,7 +54,7 @@
5354
- [x] 使用 `qrc` 管理静态资源
5455
- [ ] 翻译与国际化
5556
- [ ] Qt 提供的界面文本自动翻译
56-
- [ ] 自实现的不同语言下功能差异,如“打开PyInstaller文档”指向不同的链接等
57+
- [x] 自实现的不同语言下功能差异,如“打开PyInstaller文档”指向不同的链接等
5758

5859
## 应用程序级
5960

poetry.lock

Lines changed: 26 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "py2exe-gui"
3-
version = "0.1.12"
3+
version = "0.1.13"
44
description = "GUI for PyInstaller, based on PySide6"
55
keywords = ["PyInstaller", "GUI", "PySide6"]
66
authors = ["muzing <muzi2001@foxmail.com>"]
@@ -21,7 +21,7 @@ py2exe-gui = 'py2exe_gui.__main__:main'
2121
#priority = "default"
2222

2323
[tool.poetry.dependencies]
24-
python = ">=3.8,<3.12"
24+
python = ">=3.8,<3.13"
2525
PySide6 = "^6.6.0"
2626
pyyaml = "^6.0.1"
2727

@@ -39,11 +39,12 @@ types-pyyaml = "^6.0.12.12"
3939
[tool.black]
4040
line-length = 88
4141
target-version = ["py311"]
42-
extend-exclude = "compiled_resources.py"
42+
extend-exclude = "COMPILED_RESOURCES.py"
4343

4444
[tool.isort]
4545
profile = "black"
4646
line_length = 88
47+
py_version=311
4748

4849
[tool.mypy]
4950
python_version = "3.11"

requirements.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
pyside6-addons==6.6.1 ; python_version >= "3.8" and python_version < "3.12"
2-
pyside6-essentials==6.6.1 ; python_version >= "3.8" and python_version < "3.12"
3-
pyside6==6.6.1 ; python_version >= "3.8" and python_version < "3.12"
4-
shiboken6==6.6.1 ; python_version >= "3.8" and python_version < "3.12"
1+
pyside6-addons==6.6.1 ; python_version >= "3.8" and python_version < "3.13"
2+
pyside6-essentials==6.6.1 ; python_version >= "3.8" and python_version < "3.13"
3+
pyside6==6.6.1 ; python_version >= "3.8" and python_version < "3.13"
4+
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "3.13"
5+
shiboken6==6.6.1 ; python_version >= "3.8" and python_version < "3.13"

src/Py2exe-GUI.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html
22
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license
33

4+
"""
5+
程序入口脚本
6+
由于整个程序作为单一 Python 包发布,直接运行 py2exe_gui.__main__.py 会导致相对导入错误
7+
需要在包外留有这个显式的入口模块来提供“通过运行某个 .py 文件启动程序”功能和 PyInstaller 打包入口脚本
8+
9+
Py2exe-GUI 启动方式:
10+
python Py2exe-GUI.py
11+
12+
python -m py2exe_gui
13+
"""
14+
415
import sys
516

617
from PySide6.QtWidgets import QApplication
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html
22
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license
33

4+
"""
5+
各类常量与全局变量
6+
"""
7+
48
from .app_constants import *
59
from .packaging_constants import *
610
from .platform_constants import *
7-
from .type_constants import *
11+
from .python_env_constants import *
Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html
22
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license
33

4+
from .runtime_info import RUNTIME_INFO
5+
6+
APP_URLs = {
7+
"HOME_PAGE": "https://github.com/muziing/Py2exe-GUI",
8+
"BugTracker": "https://github.com/muziing/Py2exe-GUI/issues",
9+
"Pyinstaller_doc": "https://pyinstaller.org/",
10+
}
11+
12+
if RUNTIME_INFO.language_code == "zh_CN":
13+
APP_URLs["Pyinstaller_doc"] = "https://muzing.gitbook.io/pyinstaller-docs-zh-cn/"
14+
415

516
class AppConstant:
617
"""
718
应用程序级的常量
819
"""
920

1021
NAME = "Py2exe-GUI"
11-
VERSION = "0.1.12"
22+
VERSION = "0.1.13"
1223
AUTHORS = ["muzing <muzi2001@foxmail.com>"]
1324
LICENSE = "GPL-3.0-or-later"
25+
HOME_PAGE = APP_URLs["HOME_PAGE"]

0 commit comments

Comments
 (0)