pbs-installer 2024.10.8__py3-none-any.whl → 2024.10.16__py3-none-any.whl
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/_install.py +20 -6
- pbs_installer/_utils.py +1 -1
- pbs_installer/_versions.py +927 -903
- {pbs_installer-2024.10.8.dist-info → pbs_installer-2024.10.16.dist-info}/METADATA +1 -1
- pbs_installer-2024.10.16.dist-info/RECORD +11 -0
- {pbs_installer-2024.10.8.dist-info → pbs_installer-2024.10.16.dist-info}/WHEEL +1 -1
- pbs_installer-2024.10.8.dist-info/RECORD +0 -11
- {pbs_installer-2024.10.8.dist-info → pbs_installer-2024.10.16.dist-info}/entry_points.txt +0 -0
- {pbs_installer-2024.10.8.dist-info → pbs_installer-2024.10.16.dist-info}/licenses/LICENSE +0 -0
pbs_installer/_install.py
CHANGED
|
@@ -10,11 +10,11 @@ from urllib.parse import unquote
|
|
|
10
10
|
from ._utils import PythonVersion, get_arch_platform
|
|
11
11
|
|
|
12
12
|
if TYPE_CHECKING:
|
|
13
|
+
from typing import Literal
|
|
14
|
+
|
|
13
15
|
import httpx
|
|
14
16
|
from _typeshed import StrPath
|
|
15
17
|
|
|
16
|
-
from typing import Literal
|
|
17
|
-
|
|
18
18
|
PythonImplementation = Literal["cpython", "pypy"]
|
|
19
19
|
|
|
20
20
|
logger = logging.getLogger(__name__)
|
|
@@ -38,6 +38,7 @@ def get_download_link(
|
|
|
38
38
|
platform: str = THIS_PLATFORM,
|
|
39
39
|
implementation: PythonImplementation = "cpython",
|
|
40
40
|
build_dir: bool = False,
|
|
41
|
+
free_threaded: bool = False,
|
|
41
42
|
) -> tuple[PythonVersion, PythonFile]:
|
|
42
43
|
"""Get the download URL matching the given requested version.
|
|
43
44
|
|
|
@@ -47,6 +48,7 @@ def get_download_link(
|
|
|
47
48
|
platform: The platform to install, e.g. linux, macos
|
|
48
49
|
implementation: The implementation of Python to install, allowed values are 'cpython' and 'pypy'
|
|
49
50
|
build_dir: Whether to include the `build/` directory from indygreg builds
|
|
51
|
+
free_threaded: Whether to install the freethreaded version of Python
|
|
50
52
|
|
|
51
53
|
Returns:
|
|
52
54
|
A tuple of the PythonVersion and the download URL
|
|
@@ -62,10 +64,16 @@ def get_download_link(
|
|
|
62
64
|
if not py_ver.matches(request, implementation):
|
|
63
65
|
continue
|
|
64
66
|
|
|
65
|
-
|
|
67
|
+
if request.endswith("t"):
|
|
68
|
+
free_threaded = True
|
|
69
|
+
|
|
70
|
+
matched = urls.get((platform, arch, not build_dir, free_threaded))
|
|
66
71
|
if matched is not None:
|
|
67
72
|
return py_ver, matched
|
|
68
|
-
if
|
|
73
|
+
if (
|
|
74
|
+
not build_dir
|
|
75
|
+
and (matched := urls.get((platform, arch, False, free_threaded))) is not None
|
|
76
|
+
):
|
|
69
77
|
return py_ver, matched
|
|
70
78
|
raise ValueError(
|
|
71
79
|
f"Could not find a version matching version={request!r}, implementation={implementation}"
|
|
@@ -162,6 +170,7 @@ def install(
|
|
|
162
170
|
platform: str | None = None,
|
|
163
171
|
implementation: PythonImplementation = "cpython",
|
|
164
172
|
build_dir: bool = False,
|
|
173
|
+
free_threaded: bool = False,
|
|
165
174
|
) -> None:
|
|
166
175
|
"""Download and install the requested python version.
|
|
167
176
|
|
|
@@ -177,7 +186,7 @@ def install(
|
|
|
177
186
|
platform: The platform to install, e.g. linux, macos
|
|
178
187
|
implementation: The implementation of Python to install, allowed values are 'cpython' and 'pypy'
|
|
179
188
|
build_dir: Whether to include the `build/` directory from indygreg builds
|
|
180
|
-
|
|
189
|
+
free_threaded: Whether to install the freethreaded version of Python
|
|
181
190
|
Examples:
|
|
182
191
|
>>> install("3.10", "./python")
|
|
183
192
|
Installing cpython@3.10.4 to ./python
|
|
@@ -190,7 +199,12 @@ def install(
|
|
|
190
199
|
arch = THIS_ARCH
|
|
191
200
|
|
|
192
201
|
ver, python_file = get_download_link(
|
|
193
|
-
request,
|
|
202
|
+
request,
|
|
203
|
+
arch=arch,
|
|
204
|
+
platform=platform,
|
|
205
|
+
implementation=implementation,
|
|
206
|
+
build_dir=build_dir,
|
|
207
|
+
free_threaded=free_threaded,
|
|
194
208
|
)
|
|
195
209
|
if version_dir:
|
|
196
210
|
destination = os.path.join(destination, str(ver))
|
pbs_installer/_utils.py
CHANGED
|
@@ -27,7 +27,7 @@ class PythonVersion(NamedTuple):
|
|
|
27
27
|
if implementation != self.implementation:
|
|
28
28
|
return False
|
|
29
29
|
try:
|
|
30
|
-
parts = tuple(int(v) for v in request.split("."))
|
|
30
|
+
parts = tuple(int(v) for v in request.rstrip("t").split("."))
|
|
31
31
|
except ValueError:
|
|
32
32
|
raise ValueError(
|
|
33
33
|
f"Invalid version: {request!r}, each part must be an integer"
|