ducktools-pythonfinder 0.8.6__tar.gz → 0.8.7__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.
- {ducktools_pythonfinder-0.8.6/src/ducktools_pythonfinder.egg-info → ducktools_pythonfinder-0.8.7}/PKG-INFO +1 -1
- ducktools_pythonfinder-0.8.7/src/ducktools/pythonfinder/_version.py +2 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/pythonorg_search.py +19 -13
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7/src/ducktools_pythonfinder.egg-info}/PKG-INFO +1 -1
- ducktools_pythonfinder-0.8.7/tests/sources/release.json +1 -0
- ducktools_pythonfinder-0.8.7/tests/sources/release_file.json +1 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_orgsearch.py +33 -30
- ducktools_pythonfinder-0.8.6/src/ducktools/pythonfinder/_version.py +0 -2
- ducktools_pythonfinder-0.8.6/tests/sources/release.json +0 -1
- ducktools_pythonfinder-0.8.6/tests/sources/release_file.json +0 -1
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/.gitignore +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/LICENSE +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/MANIFEST.in +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/README.md +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/pyproject.toml +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/scripts/build_zipapp.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/scripts/detail_this_python.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/scripts/list_python_venvs.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/scripts/print_python_versions.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/setup.cfg +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/__init__.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/__main__.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/darwin/__init__.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/details_script.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/linux/__init__.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/linux/pyenv_search.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/package_list_script.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/shared.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/venv.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/win32/__init__.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/win32/pyenv_search.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools/pythonfinder/win32/registry_search.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools_pythonfinder.egg-info/SOURCES.txt +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools_pythonfinder.egg-info/dependency_links.txt +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools_pythonfinder.egg-info/entry_points.txt +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools_pythonfinder.egg-info/requires.txt +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/src/ducktools_pythonfinder.egg-info/top_level.txt +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/conftest.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/sources/python_versions.txt +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_cache.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_details_script.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_foldersearch.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_pyenv.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_shared.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_uv_finder.py +0 -0
- {ducktools_pythonfinder-0.8.6 → ducktools_pythonfinder-0.8.7}/tests/test_venv_finder.py +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
# ducktools-pythonfinder
|
|
2
2
|
# MIT License
|
|
3
|
-
#
|
|
3
|
+
#
|
|
4
4
|
# Copyright (c) 2023-2025 David C Ellis
|
|
5
|
-
#
|
|
5
|
+
#
|
|
6
6
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
7
|
# of this software and associated documentation files (the "Software"), to deal
|
|
8
8
|
# in the Software without restriction, including without limitation the rights
|
|
9
9
|
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
10
|
# copies of the Software, and to permit persons to whom the Software is
|
|
11
11
|
# furnished to do so, subject to the following conditions:
|
|
12
|
-
#
|
|
12
|
+
#
|
|
13
13
|
# The above copyright notice and this permission notice shall be included in all
|
|
14
14
|
# copies or substantial portions of the Software.
|
|
15
|
-
#
|
|
15
|
+
#
|
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
17
|
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
18
|
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
@@ -31,6 +31,7 @@ from __future__ import annotations
|
|
|
31
31
|
|
|
32
32
|
import json
|
|
33
33
|
import platform
|
|
34
|
+
import re
|
|
34
35
|
|
|
35
36
|
from urllib.request import urlopen
|
|
36
37
|
|
|
@@ -44,6 +45,8 @@ from ducktools.pythonfinder.shared import version_str_to_tuple
|
|
|
44
45
|
RELEASE_PAGE = "https://www.python.org/api/v2/downloads/release/"
|
|
45
46
|
RELEASE_FILE_PAGE = "https://www.python.org/api/v2/downloads/release_file/"
|
|
46
47
|
|
|
48
|
+
PYTHON_RELEASE_RE = re.compile(R"Python \d+\.\d+\.\d+(?:(?:a|b|rc)\d)?")
|
|
49
|
+
|
|
47
50
|
|
|
48
51
|
class UnsupportedError(Exception):
|
|
49
52
|
pass
|
|
@@ -206,13 +209,16 @@ class PythonOrgSearch(Prefab):
|
|
|
206
209
|
def releases(self) -> list[PythonRelease]:
|
|
207
210
|
"""Get all releases from python.org/api/v2/downloads/release"""
|
|
208
211
|
if self._releases is None:
|
|
209
|
-
if self.release_page_cache:
|
|
210
|
-
data = json.loads(self.release_page_cache)
|
|
211
|
-
else: # pragma: nocover
|
|
212
|
+
if not self.release_page_cache:
|
|
212
213
|
with urlopen(self.release_page) as req:
|
|
213
|
-
|
|
214
|
+
self.release_page_cache = req.read().decode("utf8")
|
|
215
|
+
|
|
216
|
+
data = json.loads(self.release_page_cache)
|
|
214
217
|
|
|
215
|
-
self._releases = [
|
|
218
|
+
self._releases = [
|
|
219
|
+
PythonRelease.from_dict(release) for release in data
|
|
220
|
+
if PYTHON_RELEASE_RE.fullmatch(release["name"])
|
|
221
|
+
]
|
|
216
222
|
self._releases.sort(key=lambda ver: ver.version_tuple, reverse=True)
|
|
217
223
|
|
|
218
224
|
return self._releases
|
|
@@ -221,11 +227,11 @@ class PythonOrgSearch(Prefab):
|
|
|
221
227
|
def release_files(self) -> list[PythonReleaseFile]:
|
|
222
228
|
"""Get all release files from python.org/api/v2/downloads/release"""
|
|
223
229
|
if self._release_files is None:
|
|
224
|
-
if self.release_file_page_cache:
|
|
225
|
-
data = json.loads(self.release_file_page_cache)
|
|
226
|
-
else: # pragma: nocover
|
|
230
|
+
if not self.release_file_page_cache:
|
|
227
231
|
with urlopen(self.release_file_page) as req:
|
|
228
|
-
|
|
232
|
+
self.release_file_page_cache = req.read().decode("utf8")
|
|
233
|
+
|
|
234
|
+
data = json.loads(self.release_file_page_cache)
|
|
229
235
|
|
|
230
236
|
self._release_files = [PythonReleaseFile.from_dict(relfile) for relfile in data]
|
|
231
237
|
return self._release_files
|