python-discovery 1.6.4__py3-none-any.whl → 1.6.6__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.
@@ -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
- return str(Path(path).absolute())
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:
@@ -295,7 +295,8 @@ class PythonInfo: # ruff:ignore[too-many-public-methods]
295
295
  return True
296
296
  version_info = self.version_info
297
297
  for specifier in spec.version_specifier:
298
- assert specifier.version is not None # ruff:ignore[assert]
298
+ if specifier.version is None: # a hand-built spec can carry an unparsable version, which matches nothing
299
+ return False
299
300
  numeric_version = specifier.version_str
300
301
  for prefix in ("rc", "b", "a"):
301
302
  if prefix in numeric_version:
@@ -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":
@@ -227,12 +227,10 @@ class SimpleSpecifier:
227
227
  return False
228
228
  if candidate < self.version:
229
229
  return False
230
- if len(self.version.release) >= 2: # ruff:ignore[magic-value-comparison] # pragma: no branch # SimpleVersion always has 3-part release
231
- upper_parts = list(self.version.release[:-1])
232
- upper_parts[-1] += 1
233
- upper = SimpleVersion.from_string(".".join(str(p) for p in upper_parts))
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):
@@ -1,36 +1,19 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: python-discovery
3
- Version: 1.6.4
3
+ Version: 1.6.6
4
+ Import-Name: python_discovery
4
5
  Summary: Python interpreter discovery
5
- Project-URL: Changelog, https://github.com/tox-dev/python-discovery/releases
6
+ Project-URL: Changelog, https://github.com/tox-dev/python-discovery/blob/main/docs/changelog.rst
6
7
  Project-URL: Documentation, https://python-discovery.readthedocs.io
7
8
  Project-URL: Homepage, https://github.com/tox-dev/python-discovery
8
9
  Project-URL: Source, https://github.com/tox-dev/python-discovery
9
10
  Project-URL: Tracker, https://github.com/tox-dev/python-discovery/issues
10
11
  Maintainer-email: Bernát Gábor <gaborjbernat@gmail.com>
11
- License: Permission is hereby granted, free of charge, to any person obtaining a
12
- copy of this software and associated documentation files (the
13
- "Software"), to deal in the Software without restriction, including
14
- without limitation the rights to use, copy, modify, merge, publish,
15
- distribute, sublicense, and/or sell copies of the Software, and to
16
- permit persons to whom the Software is furnished to do so, subject to
17
- the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included
20
- in all copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
23
- OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
25
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
26
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
27
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
28
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
12
+ License-Expression: MIT
29
13
  License-File: LICENSE
30
14
  Keywords: discovery,interpreter,python
31
15
  Classifier: Development Status :: 5 - Production/Stable
32
16
  Classifier: Intended Audience :: Developers
33
- Classifier: License :: OSI Approved :: MIT License
34
17
  Classifier: Operating System :: MacOS :: MacOS X
35
18
  Classifier: Operating System :: Microsoft :: Windows
36
19
  Classifier: Operating System :: POSIX
@@ -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=BDHC1XEx0XNStEIbXjujpHHm0nkBpe26bl26YVHSWhM,22488
6
- python_discovery/_py_info.py,sha256=rRyixfRnqyrmudr7SSSKLxKfsCjdfSezH30YE6n773U,26672
5
+ python_discovery/_discovery.py,sha256=E5b-Sb6jLq_5hVOK0LZwKwvUxMNVsH9UPmf0dCpzZnA,22580
6
+ python_discovery/_py_info.py,sha256=SDBYXdoL3aXTfLOgHXrElXK_Og5cJOeJPK7j3rNvTu8,26747
7
7
  python_discovery/_py_info_collect.py,sha256=3PNlySbxNSHDjBw8KJ_olVpOXww1qhGdY28YoLfF0Z8,16160
8
- python_discovery/_py_spec.py,sha256=1L7uVqpLdTVvHX6ZcXiUICFAfnOcJaThfdCGIntp7l4,11073
9
- python_discovery/_specifier.py,sha256=o7MHb0z_mFSLz9gXqMwJoNkHYjgi2biq3Ibvd0_slvc,10457
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.4.dist-info/METADATA,sha256=GuigqMmqb8Ejwv3GHSRDw2PV9OTyDSkOJ1giuXqvCOU,5082
15
- python_discovery-1.6.4.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
16
- python_discovery-1.6.4.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
17
- python_discovery-1.6.4.dist-info/RECORD,,
14
+ python_discovery-1.6.6.dist-info/METADATA,sha256=ALuIM6ZR6RkPYhHcBUyz9t1OiidUMOiOU1eXi0_R284,3937
15
+ python_discovery-1.6.6.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
16
+ python_discovery-1.6.6.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
17
+ python_discovery-1.6.6.dist-info/RECORD,,