python-discovery 1.6.5__py3-none-any.whl → 1.6.7__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.
- python_discovery/_discovery.py +5 -3
- python_discovery/_py_info.py +7 -2
- python_discovery/_py_spec.py +5 -0
- python_discovery/_specifier.py +4 -6
- {python_discovery-1.6.5.dist-info → python_discovery-1.6.7.dist-info}/METADATA +1 -1
- {python_discovery-1.6.5.dist-info → python_discovery-1.6.7.dist-info}/RECORD +8 -8
- {python_discovery-1.6.5.dist-info → python_discovery-1.6.7.dist-info}/WHEEL +0 -0
- {python_discovery-1.6.5.dist-info → python_discovery-1.6.7.dist-info}/licenses/LICENSE +0 -0
python_discovery/_discovery.py
CHANGED
|
@@ -158,7 +158,8 @@ def _check_exe(path: str, tested_exes: set[str]) -> str | None:
|
|
|
158
158
|
if exe_id in tested_exes:
|
|
159
159
|
return None
|
|
160
160
|
tested_exes.add(exe_id)
|
|
161
|
-
|
|
161
|
+
# unlike Path.absolute(), abspath collapses "..", which PythonInfo._satisfies_path relies on
|
|
162
|
+
return os.path.abspath(path)
|
|
162
163
|
|
|
163
164
|
|
|
164
165
|
def _is_new_exe(exe_raw: str, tested_exes: set[str]) -> bool:
|
|
@@ -388,8 +389,9 @@ def _uv_sort_key(install: _UvInstall) -> tuple[int, ...]:
|
|
|
388
389
|
version = key.version
|
|
389
390
|
return (
|
|
390
391
|
impl_order.index(key.implementation) if key.implementation in impl_order else len(impl_order),
|
|
391
|
-
# uv's minor version links point at a concrete install that moves on upgrade, so report the target instead
|
|
392
|
-
|
|
392
|
+
# uv's minor version links point at a concrete install that moves on upgrade, so report the target instead;
|
|
393
|
+
# spot them by the name they resolve to, as on Windows they are junctions, which is_symlink() does not report
|
|
394
|
+
int(install.path.resolve().name != install.path.name),
|
|
393
395
|
-version.major,
|
|
394
396
|
-version.minor,
|
|
395
397
|
-version.micro,
|
python_discovery/_py_info.py
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
import copy
|
|
5
6
|
import json
|
|
6
7
|
import logging
|
|
7
8
|
import os
|
|
@@ -295,7 +296,8 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
|
|
|
295
296
|
return True
|
|
296
297
|
version_info = self.version_info
|
|
297
298
|
for specifier in spec.version_specifier:
|
|
298
|
-
|
|
299
|
+
if specifier.version is None: # a hand-built spec can carry an unparsable version, which matches nothing
|
|
300
|
+
return False
|
|
299
301
|
numeric_version = specifier.version_str
|
|
300
302
|
for prefix in ("rc", "b", "a"):
|
|
301
303
|
if prefix in numeric_version:
|
|
@@ -474,7 +476,10 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
|
|
|
474
476
|
resolved = cls.from_exe(target.system_executable, cache)
|
|
475
477
|
if resolved is not None:
|
|
476
478
|
target = resolved
|
|
477
|
-
target.executable
|
|
479
|
+
if target.executable != start_executable:
|
|
480
|
+
# the cache hands every lookup of this base the same object, so point a copy at the start executable
|
|
481
|
+
target = copy.copy(target)
|
|
482
|
+
target.executable = start_executable
|
|
478
483
|
return target
|
|
479
484
|
|
|
480
485
|
_cache_exe_discovery: ClassVar[dict[tuple[str, bool], PythonInfo]] = {}
|
python_discovery/_py_spec.py
CHANGED
|
@@ -104,6 +104,11 @@ def _parse_specifier(string_spec: str) -> PythonSpec | None:
|
|
|
104
104
|
version_specifier = SpecifierSet.from_string(spec_text)
|
|
105
105
|
except InvalidSpecifier: # pragma: no cover
|
|
106
106
|
return None
|
|
107
|
+
# the set never raises: it keeps an unparsable version as None and drops items without an operator, so fall back
|
|
108
|
+
# to a literal path, like any other unrecognized spec, unless every item parsed into a usable version
|
|
109
|
+
items = [item for item in spec_text.split(",") if item.strip()]
|
|
110
|
+
if len(items) != len(version_specifier.specifiers) or any(spec.version is None for spec in version_specifier):
|
|
111
|
+
return None
|
|
107
112
|
if impl in {"py", "python"}:
|
|
108
113
|
impl = None
|
|
109
114
|
if impl == "graalvm":
|
python_discovery/_specifier.py
CHANGED
|
@@ -227,12 +227,10 @@ class SimpleSpecifier:
|
|
|
227
227
|
return False
|
|
228
228
|
if candidate < self.version:
|
|
229
229
|
return False
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return candidate < upper
|
|
235
|
-
return True # pragma: no cover
|
|
230
|
+
# ~=X.Y is >=X.Y, ==X.*: compare all but the last part the spec wrote (release is padded to three).
|
|
231
|
+
# A bare ~=X still compares its one part, so it stays ==X.*.
|
|
232
|
+
prefix = max(self.version_str.count("."), 1)
|
|
233
|
+
return candidate.release[:prefix] == self.version.release[:prefix]
|
|
236
234
|
|
|
237
235
|
def __eq__(self, other: object) -> bool:
|
|
238
236
|
if not isinstance(other, SimpleSpecifier):
|
|
@@ -2,16 +2,16 @@ python_discovery/__init__.py,sha256=Hi4j3pMvC8Fo8KoNL-wOHsPSCUHwY4c0qvv5sjnFzME,
|
|
|
2
2
|
python_discovery/_cache.py,sha256=svmG2GzUQzd2xTjAbm2eX1CKxxGAglfv4kxaPuxwPIA,5147
|
|
3
3
|
python_discovery/_cached_py_info.py,sha256=15P5_TODxkZCkNfD2Uk5dtPxGf0Nea_aWm2N7uY9zbY,12059
|
|
4
4
|
python_discovery/_compat.py,sha256=iqxGuhK9rPaiui80G1H1KrweoMJ16gyLYEmUrSXrp5c,709
|
|
5
|
-
python_discovery/_discovery.py,sha256=
|
|
6
|
-
python_discovery/_py_info.py,sha256=
|
|
5
|
+
python_discovery/_discovery.py,sha256=mV1dp7fkyAhXAKjlykRGCQcszQkNQ3UJ-VrDCB0LOSI,22722
|
|
6
|
+
python_discovery/_py_info.py,sha256=fAhFj5swYdGvhJpAXR6b6O1yT2MSbRXTDMrdu15e6q8,26965
|
|
7
7
|
python_discovery/_py_info_collect.py,sha256=3PNlySbxNSHDjBw8KJ_olVpOXww1qhGdY28YoLfF0Z8,16160
|
|
8
|
-
python_discovery/_py_spec.py,sha256=
|
|
9
|
-
python_discovery/_specifier.py,sha256=
|
|
8
|
+
python_discovery/_py_spec.py,sha256=uN6PftKwk8cJnnbav5kXpbnQQYQ56LZ828KLp04YGKU,11499
|
|
9
|
+
python_discovery/_specifier.py,sha256=9sMnJs7FTfIIduTCKKTA7Lk7onARqwkG_zzFIqgj0xs,10364
|
|
10
10
|
python_discovery/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
python_discovery/_windows/__init__.py,sha256=qthcyGh36b3WkeSbZ4ECRRYLbCOCaQu5X_DRZ98tXfk,315
|
|
12
12
|
python_discovery/_windows/_pep514.py,sha256=Vhxe-3hETFIXQrekLqOHmzG5eq5moeR8b0dCS80zbBg,8026
|
|
13
13
|
python_discovery/_windows/_propose.py,sha256=EE-N-BiNgrFU9mQ34SkoF5gRaNjtspghssQxT9uRQi0,1756
|
|
14
|
-
python_discovery-1.6.
|
|
15
|
-
python_discovery-1.6.
|
|
16
|
-
python_discovery-1.6.
|
|
17
|
-
python_discovery-1.6.
|
|
14
|
+
python_discovery-1.6.7.dist-info/METADATA,sha256=lnUw1wj_IpXgeaROo05hjAbznwmCY_9DaEOjRkjSYVw,3937
|
|
15
|
+
python_discovery-1.6.7.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
16
|
+
python_discovery-1.6.7.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
|
|
17
|
+
python_discovery-1.6.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|