-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from muziing/dev
Version `0.1.13`
- Loading branch information
Showing
33 changed files
with
2,995 additions
and
784 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pyside6-addons==6.6.1 ; python_version >= "3.8" and python_version < "3.12" | ||
pyside6-essentials==6.6.1 ; python_version >= "3.8" and python_version < "3.12" | ||
pyside6==6.6.1 ; python_version >= "3.8" and python_version < "3.12" | ||
shiboken6==6.6.1 ; python_version >= "3.8" and python_version < "3.12" | ||
pyside6-addons==6.6.1 ; python_version >= "3.8" and python_version < "3.13" | ||
pyside6-essentials==6.6.1 ; python_version >= "3.8" and python_version < "3.13" | ||
pyside6==6.6.1 ; python_version >= "3.8" and python_version < "3.13" | ||
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "3.13" | ||
shiboken6==6.6.1 ; python_version >= "3.8" and python_version < "3.13" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html | ||
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license | ||
|
||
""" | ||
各类常量与全局变量 | ||
""" | ||
|
||
from .app_constants import * | ||
from .packaging_constants import * | ||
from .platform_constants import * | ||
from .type_constants import * | ||
from .python_env_constants import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,25 @@ | ||
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html | ||
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license | ||
|
||
from .runtime_info import RUNTIME_INFO | ||
|
||
APP_URLs = { | ||
"HOME_PAGE": "https://github.com/muziing/Py2exe-GUI", | ||
"BugTracker": "https://github.com/muziing/Py2exe-GUI/issues", | ||
"Pyinstaller_doc": "https://pyinstaller.org/", | ||
} | ||
|
||
if RUNTIME_INFO.language_code == "zh_CN": | ||
APP_URLs["Pyinstaller_doc"] = "https://muzing.gitbook.io/pyinstaller-docs-zh-cn/" | ||
|
||
|
||
class AppConstant: | ||
""" | ||
应用程序级的常量 | ||
""" | ||
|
||
NAME = "Py2exe-GUI" | ||
VERSION = "0.1.12" | ||
VERSION = "0.1.13" | ||
AUTHORS = ["muzing <muzi2001@foxmail.com>"] | ||
LICENSE = "GPL-3.0-or-later" | ||
HOME_PAGE = APP_URLs["HOME_PAGE"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html | ||
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license | ||
|
||
import enum | ||
import subprocess | ||
from typing import NamedTuple | ||
|
||
|
||
@enum.unique | ||
class PyEnvType(enum.IntFlag): | ||
""" | ||
Python 解释器(环境)类型,如系统解释器、venv 虚拟环境等 \n | ||
""" | ||
|
||
system = enum.auto() # 系统解释器 | ||
venv = enum.auto() # venv 虚拟环境 https://docs.python.org/3/library/venv.html | ||
poetry = enum.auto() # Poetry 环境 https://python-poetry.org/ | ||
conda = enum.auto() # conda 环境 https://docs.conda.io/en/latest/ | ||
|
||
|
||
class PyEnv(NamedTuple): | ||
""" | ||
Python 解释器(环境)数据类 | ||
""" | ||
|
||
type: PyEnvType | ||
executable_path: str | ||
|
||
|
||
def get_pyenv_version(pyenv: PyEnv) -> str: | ||
""" | ||
获取Python解释器的版本,以形如 "3.11.7" 的字符串形式返回 \n | ||
:param pyenv: Python环境 | ||
:return: Version of the Python interpreter, such as "3.11.7". | ||
""" | ||
|
||
cmd = [ | ||
pyenv.executable_path, | ||
"-c", | ||
"import platform;print(platform.python_version(), end='')", | ||
] | ||
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
version = str(result.stdout, encoding="utf-8") | ||
return version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Licensed under the GPLv3 License: https://www.gnu.org/licenses/gpl-3.0.html | ||
# For details: https://github.com/muziing/Py2exe-GUI/blob/main/README.md#license | ||
|
||
""" | ||
运行时信息 | ||
""" | ||
|
||
import sys | ||
from locale import getdefaultlocale | ||
from typing import NamedTuple, Optional | ||
|
||
from .platform_constants import PLATFORM, get_platform | ||
|
||
|
||
class RuntimeInfo(NamedTuple): | ||
""" | ||
运行时信息数据结构类 | ||
""" | ||
|
||
platform: PLATFORM # 运行平台,Windows、macOS、Linux或其他 | ||
language_code: Optional[str] # 语言环境,zh-CN、en-US 等 | ||
is_bundled: bool # 是否在已被 PyInstaller 捆绑的冻结环境中运行 | ||
|
||
|
||
# 虽然 locale.getdefaultlocale() 函数已被废弃[https://github.com/python/cpython/issues/90817], | ||
# 但仍然是目前唯一能在 Windows 平台正确获取语言编码的方式[https://github.com/python/cpython/issues/82986] | ||
# 当 Python 更新修复了这一问题后,将迁移至 locale.getlocale() | ||
language_code = getdefaultlocale()[0] | ||
|
||
# https://pyinstaller.org/en/stable/runtime-information.html#run-time-information | ||
if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"): | ||
is_bundled = True | ||
else: | ||
is_bundled = False | ||
|
||
RUNTIME_INFO = RuntimeInfo(get_platform(), language_code, is_bundled) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.