Skip to content

Commit

Permalink
Merge pull request #4 from kurtmckee/resolve-none-in-identifications
Browse files Browse the repository at this point in the history
Prevent "None" from appearing in identification output
  • Loading branch information
kurtmckee authored Oct 31, 2023
2 parents 4b4415d + 6199398 commit 7cb9da6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
14 changes: 10 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,19 @@ runs:
if ext_suffix is not None:
print(ext_suffix, end="")
else:
# Python 2.7 on GitHub macOS runners
# Python 2.7 is still pre-installed on GitHub macOS runners.
import platform
implementation = platform.python_implementation().lower()
implementation_version = "".join(platform.python_version_tuple()[:2])
platform_system = platform.system().lower()
platform_machine = platform.machine().lower()
print(
"." + platform.python_implementation().lower(),
sysconfig.get_config_var("py_version_nodot"),
sysconfig.get_config_var("MACHDEP"),
"." + implementation,
implementation_version,
platform_system,
platform_machine,
sep="-",
end="",
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Changed
-------

* ``None`` should no longer appear in the identifier
for Python interpreters missing an ``EXT_SUFFIX`` sysconfig value.
14 changes: 10 additions & 4 deletions src/detect_pythons/detector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ def main():
if ext_suffix is not None:
print(ext_suffix, end="")
else:
# Python 2.7 on GitHub macOS runners
# Python 2.7 is still pre-installed on GitHub macOS runners.
import platform
implementation = platform.python_implementation().lower()
implementation_version = "".join(platform.python_version_tuple()[:2])
platform_system = platform.system().lower()
platform_machine = platform.machine().lower()
print(
"." + platform.python_implementation().lower(),
sysconfig.get_config_var("py_version_nodot"),
sysconfig.get_config_var("MACHDEP"),
"." + implementation,
implementation_version,
platform_system,
platform_machine,
sep="-",
end="",
)
Expand Down
14 changes: 10 additions & 4 deletions src/detect_pythons/identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ def main():
if ext_suffix is not None:
print(ext_suffix, end="")
else:
# Python 2.7 on GitHub macOS runners
# Python 2.7 is still pre-installed on GitHub macOS runners.
import platform

implementation = platform.python_implementation().lower()
implementation_version = "".join(platform.python_version_tuple()[:2])
platform_system = platform.system().lower()
platform_machine = platform.machine().lower()

print(
"." + platform.python_implementation().lower(),
sysconfig.get_config_var("py_version_nodot"),
sysconfig.get_config_var("MACHDEP"),
"." + implementation,
implementation_version,
platform_system,
platform_machine,
sep="-",
end="",
)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_identify.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ def test_main_ext_suffix_fallback(capsys, monkeypatch):
assert implementation in stdout
assert version in stdout
assert stdout == stdout.strip()

assert "none" not in stdout.lower()

0 comments on commit 7cb9da6

Please sign in to comment.