python-discovery 1.3.2__py3-none-any.whl → 1.4.0__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.
@@ -12,6 +12,7 @@ import sys
12
12
  import sysconfig
13
13
  import warnings
14
14
  from collections import OrderedDict
15
+ from itertools import product
15
16
  from string import digits
16
17
  from typing import TYPE_CHECKING, ClassVar, Final, NamedTuple
17
18
 
@@ -73,6 +74,7 @@ class PythonInfo: # noqa: PLR0904
73
74
  self.version = sys.version
74
75
  self.os = os.name
75
76
  self.free_threaded = sysconfig.get_config_var("Py_GIL_DISABLED") == 1
77
+ self.debug_build = bool(sysconfig.get_config_var("Py_DEBUG"))
76
78
 
77
79
  def _init_prefixes(self) -> None:
78
80
  def abs_path(value: str | None) -> str | None:
@@ -404,10 +406,11 @@ class PythonInfo: # noqa: PLR0904
404
406
  @property
405
407
  def spec(self) -> str:
406
408
  """A specification string identifying this interpreter (e.g. ``CPython3.13.2-64-arm64``)."""
407
- return "{}{}{}-{}-{}".format(
409
+ return "{}{}{}{}-{}-{}".format(
408
410
  self.implementation,
409
411
  ".".join(str(i) for i in self.version_info),
410
412
  "t" if self.free_threaded else "",
413
+ "d" if self.debug_build else "",
411
414
  self.architecture,
412
415
  self.machine,
413
416
  )
@@ -731,17 +734,14 @@ class PythonInfo: # noqa: PLR0904
731
734
 
732
735
  def _find_possible_exe_names(self) -> list[str]:
733
736
  name_candidate = OrderedDict()
737
+ mods = ["", "t"] if self.free_threaded else [""]
738
+ debug_suffixes = ["_d", ""] if self.debug_build else [""]
739
+ archs = [f"-{self.architecture}", ""]
734
740
  for name in self._possible_base():
735
741
  for at in (3, 2, 1, 0):
736
742
  version = ".".join(str(i) for i in self.version_info[:at])
737
- mods = [""]
738
- if self.free_threaded:
739
- mods.append("t")
740
- for mod in mods:
741
- for arch in [f"-{self.architecture}", ""]:
742
- for ext in EXTENSIONS:
743
- candidate = f"{name}{version}{mod}{arch}{ext}"
744
- name_candidate[candidate] = None
743
+ for mod, debug, arch, ext in product(mods, debug_suffixes, archs, EXTENSIONS):
744
+ name_candidate[f"{name}{version}{mod}{debug}{arch}{ext}"] = None
745
745
  return list(name_candidate.keys())
746
746
 
747
747
  def _possible_base(self) -> Generator[str, None, None]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-discovery
3
- Version: 1.3.2
3
+ Version: 1.4.0
4
4
  Summary: Python interpreter discovery
5
5
  Project-URL: Changelog, https://github.com/tox-dev/python-discovery/releases
6
6
  Project-URL: Documentation, https://python-discovery.readthedocs.io
@@ -3,14 +3,14 @@ python_discovery/_cache.py,sha256=bG4fD-h2pdPmb4v9BldbXmJ5Tlt1boiH1Qrz8kp9Dds,50
3
3
  python_discovery/_cached_py_info.py,sha256=1AFEoc_-OaCi1PXmaFz9Iy_bEuqOhJdFSDFHljzD-EE,8540
4
4
  python_discovery/_compat.py,sha256=iqxGuhK9rPaiui80G1H1KrweoMJ16gyLYEmUrSXrp5c,709
5
5
  python_discovery/_discovery.py,sha256=cdo6xlktNMEwsQn2R8pn4T1VDE4LD2EJPUyCT7vlHnM,16830
6
- python_discovery/_py_info.py,sha256=ls4ZOe93RCsfjN2uEz1r4l3K8m-rtm3ZKRp59xJDJHg,34354
6
+ python_discovery/_py_info.py,sha256=XZGBI0hVIG54tjgVGX-5ZwNUuDv_RoIhEj0mBsT1R9I,34467
7
7
  python_discovery/_py_spec.py,sha256=Kky0LXi8BU_ojfMdvvRhtDk6I4WPjovwXOu6E2QYHTo,10421
8
8
  python_discovery/_specifier.py,sha256=PTh6suNTC0hMnFSxFYF_vggdciFLnwxoh1YflSbgCXA,10368
9
9
  python_discovery/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  python_discovery/_windows/__init__.py,sha256=qthcyGh36b3WkeSbZ4ECRRYLbCOCaQu5X_DRZ98tXfk,315
11
11
  python_discovery/_windows/_pep514.py,sha256=zXxje07QIXfrCB3eYbZHOBgXcvAQQpZ-ZWun3_zrapA,7688
12
12
  python_discovery/_windows/_propose.py,sha256=iMJf6l0TU4SvuV8UsCHHINAe9L5dUT949xyeyMVdong,1565
13
- python_discovery-1.3.2.dist-info/METADATA,sha256=nmMtjtmWU2DTdKudFjFa6Nrtlwk3OEDbB_BkeRYaw5A,5592
14
- python_discovery-1.3.2.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
- python_discovery-1.3.2.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
16
- python_discovery-1.3.2.dist-info/RECORD,,
13
+ python_discovery-1.4.0.dist-info/METADATA,sha256=VtlySRmCB_wZLirKeBUcSOMxKPufldx-ULtqt90Rd5k,5592
14
+ python_discovery-1.4.0.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
15
+ python_discovery-1.4.0.dist-info/licenses/LICENSE,sha256=kOJeH68qSq6o2V7o5_VziwUqGswMnFgGgQH5Mahr1Yg,1023
16
+ python_discovery-1.4.0.dist-info/RECORD,,