pbs-installer 2023.7.13.post0__tar.gz → 2023.7.14__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/PKG-INFO +7 -4
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/pyproject.toml +16 -5
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/src/pbs_installer/__init__.py +7 -0
- pbs_installer-2023.7.14/src/pbs_installer/__main__.py +31 -0
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/src/pbs_installer/_install.py +35 -3
- pbs_installer-2023.7.13.post0/src/pbs_installer/__main__.py +0 -17
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/LICENSE +0 -0
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/README.md +0 -0
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/src/pbs_installer/_utils.py +0 -0
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/src/pbs_installer/_versions.py +0 -0
- {pbs_installer-2023.7.13.post0 → pbs_installer-2023.7.14}/tests/__init__.py +0 -0
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pbs-installer
|
|
3
|
-
Version: 2023.7.
|
|
3
|
+
Version: 2023.7.14
|
|
4
4
|
Summary: Installer for Python Build Standalone
|
|
5
5
|
Author-Email: Frost Ming <me@frostming.com>
|
|
6
6
|
License: MIT
|
|
7
7
|
Requires-Python: >=3.7
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Provides-Extra:
|
|
8
|
+
Provides-Extra: download
|
|
9
|
+
Provides-Extra: install
|
|
10
|
+
Provides-Extra: all
|
|
11
|
+
Requires-Dist: requests>=2.24.0; extra == "download"
|
|
12
|
+
Requires-Dist: zstandard>=0.21.0; extra == "install"
|
|
13
|
+
Requires-Dist: pbs-installer[download,install]; extra == "all"
|
|
11
14
|
Description-Content-Type: text/markdown
|
|
12
15
|
|
|
13
16
|
# pbs-installer
|
|
@@ -4,21 +4,25 @@ description = "Installer for Python Build Standalone"
|
|
|
4
4
|
authors = [
|
|
5
5
|
{ name = "Frost Ming", email = "me@frostming.com" },
|
|
6
6
|
]
|
|
7
|
-
dependencies = [
|
|
8
|
-
"zstandard>=0.21.0",
|
|
9
|
-
]
|
|
7
|
+
dependencies = []
|
|
10
8
|
requires-python = ">=3.7"
|
|
11
9
|
readme = "README.md"
|
|
12
10
|
dynamic = []
|
|
13
|
-
version = "2023.7.
|
|
11
|
+
version = "2023.7.14"
|
|
14
12
|
|
|
15
13
|
[project.license]
|
|
16
14
|
text = "MIT"
|
|
17
15
|
|
|
18
16
|
[project.optional-dependencies]
|
|
19
|
-
|
|
17
|
+
download = [
|
|
20
18
|
"requests>=2.24.0",
|
|
21
19
|
]
|
|
20
|
+
install = [
|
|
21
|
+
"zstandard>=0.21.0",
|
|
22
|
+
]
|
|
23
|
+
all = [
|
|
24
|
+
"pbs-installer[download,install]",
|
|
25
|
+
]
|
|
22
26
|
|
|
23
27
|
[project.scripts]
|
|
24
28
|
pbs-install = "pbs_installer.__main__:main"
|
|
@@ -44,3 +48,10 @@ shell = "./scripts/update.sh"
|
|
|
44
48
|
line-length = 100
|
|
45
49
|
include = "\\.pyi?$"
|
|
46
50
|
exclude = "/(\n \\.eggs\n | \\.git\n | \\.hg\n | \\.mypy_cache\n | \\.tox\n | \\.venv\n | build\n | dist\n | src/pythonfinder/_vendor\n)\n"
|
|
51
|
+
|
|
52
|
+
[tool.ruff]
|
|
53
|
+
line-length = 100
|
|
54
|
+
extend-select = [
|
|
55
|
+
"I",
|
|
56
|
+
]
|
|
57
|
+
target-version = "py310"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from argparse import ArgumentParser
|
|
3
|
+
|
|
4
|
+
from ._install import install
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def _setup_logger(verbose: bool):
|
|
8
|
+
logger = logging.getLogger("pbs_installer")
|
|
9
|
+
handler = logging.StreamHandler()
|
|
10
|
+
handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
|
|
11
|
+
logger.addHandler(handler)
|
|
12
|
+
logger.setLevel(logging.DEBUG if verbose else logging.WARNING)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
parser = ArgumentParser("pbs-install", description="Installer for Python Build Standalone")
|
|
17
|
+
parser.add_argument("version", help="The version of Python to install, e.g. 3.8,3.10.4")
|
|
18
|
+
parser.add_argument(
|
|
19
|
+
"--version-dir", help="Install to a subdirectory named by the version", action="store_true"
|
|
20
|
+
)
|
|
21
|
+
parser.add_argument("-v", "--verbose", help="Enable verbose logging", action="store_true")
|
|
22
|
+
parser.add_argument("-d", "--destination", help="The directory to install to", required=True)
|
|
23
|
+
|
|
24
|
+
args = parser.parse_args()
|
|
25
|
+
_setup_logger(args.verbose)
|
|
26
|
+
install(args.version, args.destination, version_dir=args.version_dir)
|
|
27
|
+
print("Done!")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
if __name__ == "__main__":
|
|
31
|
+
main()
|
|
@@ -29,6 +29,11 @@ def _get_headers() -> dict[str, str] | None:
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
def get_download_link(request: str) -> tuple[PythonVersion, str]:
|
|
32
|
+
"""Get the download URL matching the given requested version.
|
|
33
|
+
|
|
34
|
+
:param request: The version of Python to install, e.g. 3.8,3.10.4
|
|
35
|
+
:return: A tuple of the PythonVersion and the download URL
|
|
36
|
+
"""
|
|
32
37
|
from ._versions import PYTHON_VERSIONS
|
|
33
38
|
|
|
34
39
|
for py_ver, urls in PYTHON_VERSIONS.items():
|
|
@@ -54,6 +59,13 @@ def _read_sha256(url: str, sess: requests.Session) -> str | None:
|
|
|
54
59
|
|
|
55
60
|
|
|
56
61
|
def download(url: str, destination: StrPath, session: requests.Session | None = None) -> str:
|
|
62
|
+
"""Download the given url to the destination.
|
|
63
|
+
|
|
64
|
+
:param url: The url to download
|
|
65
|
+
:param destination: The file path to download to
|
|
66
|
+
:param session: A requests session to use for downloading, or None to create a new one
|
|
67
|
+
:return: The original filename of the downloaded file
|
|
68
|
+
"""
|
|
57
69
|
logger.debug("Downloading url %s to %s", url, destination)
|
|
58
70
|
filename = unquote(url.rsplit("/")[-1])
|
|
59
71
|
try:
|
|
@@ -83,6 +95,13 @@ def download(url: str, destination: StrPath, session: requests.Session | None =
|
|
|
83
95
|
def install_file(
|
|
84
96
|
filename: StrPath, destination: StrPath, original_filename: str | None = None
|
|
85
97
|
) -> None:
|
|
98
|
+
"""Unpack the downloaded file to the destination.
|
|
99
|
+
|
|
100
|
+
:param filename: The file to unpack
|
|
101
|
+
:param destination: The directory to unpack to
|
|
102
|
+
:param original_filename: The original filename of the file, if it was renamed
|
|
103
|
+
"""
|
|
104
|
+
|
|
86
105
|
import tarfile
|
|
87
106
|
|
|
88
107
|
import zstandard as zstd
|
|
@@ -109,10 +128,23 @@ def install_file(
|
|
|
109
128
|
unpack_tar(z, destination, 1)
|
|
110
129
|
|
|
111
130
|
|
|
112
|
-
def install(
|
|
113
|
-
|
|
131
|
+
def install(
|
|
132
|
+
request: str,
|
|
133
|
+
destination: StrPath,
|
|
134
|
+
version_dir: bool = False,
|
|
135
|
+
session: requests.Session | None = None,
|
|
136
|
+
) -> None:
|
|
137
|
+
"""Download and install the requested python version.
|
|
138
|
+
|
|
139
|
+
:param request: The version of Python to install, e.g. 3.8,3.10.4
|
|
140
|
+
:param destination: The directory to install to
|
|
141
|
+
:param version_dir: Whether to install to a subdirectory named with the python version
|
|
142
|
+
:param session: A requests session to use for downloading
|
|
143
|
+
"""
|
|
114
144
|
ver, url = get_download_link(request)
|
|
115
|
-
|
|
145
|
+
if version_dir:
|
|
146
|
+
destination = os.path.join(destination, str(ver))
|
|
147
|
+
logger.debug("Installing %s to %s", ver, destination)
|
|
116
148
|
os.makedirs(destination, exist_ok=True)
|
|
117
149
|
with tempfile.NamedTemporaryFile() as tf:
|
|
118
150
|
tf.close()
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
from argparse import ArgumentParser
|
|
2
|
-
|
|
3
|
-
from ._install import install
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
def main():
|
|
7
|
-
parser = ArgumentParser("pbs-install")
|
|
8
|
-
parser.add_argument("version", help="The version of Python to install, e.g. 3.8,3.10.4")
|
|
9
|
-
parser.add_argument("-d", "--destination", help="The directory to install to", required=True)
|
|
10
|
-
|
|
11
|
-
args = parser.parse_args()
|
|
12
|
-
install(args.version, args.destination)
|
|
13
|
-
print("Done!")
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if __name__ == "__main__":
|
|
17
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|