fix: accept current Python version if acceptable for Pyodide (#1868)
* fix: accept current Python version if acceptable for Pyodide Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
This commit is contained in:
+2
-2
@@ -24,11 +24,11 @@ branding:
|
|||||||
runs:
|
runs:
|
||||||
using: composite
|
using: composite
|
||||||
steps:
|
steps:
|
||||||
# Set up a non-EOL, cibuildwheel & pipx supported Python version
|
# Set up the version of Python that supports pyodide
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
id: python
|
id: python
|
||||||
with:
|
with:
|
||||||
python-version: "3.8 - 3.12"
|
python-version: "3.12"
|
||||||
update-environment: false
|
update-environment: false
|
||||||
|
|
||||||
- id: cibw
|
- id: cibw
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
from collections.abc import Sequence, Set
|
from collections.abc import Sequence, Set
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
@@ -92,7 +93,11 @@ def install_xbuildenv(env: dict[str, str], pyodide_version: str) -> str:
|
|||||||
def get_base_python(identifier: str) -> Path:
|
def get_base_python(identifier: str) -> Path:
|
||||||
implementation_id = identifier.split("-")[0]
|
implementation_id = identifier.split("-")[0]
|
||||||
majorminor = implementation_id[len("cp") :]
|
majorminor = implementation_id[len("cp") :]
|
||||||
major_minor = f"{majorminor[0]}.{majorminor[1:]}"
|
version_info = (int(majorminor[0]), int(majorminor[1:]))
|
||||||
|
if version_info == sys.version_info[:2]:
|
||||||
|
return Path(sys.executable)
|
||||||
|
|
||||||
|
major_minor = ".".join(str(v) for v in version_info)
|
||||||
python_name = f"python{major_minor}"
|
python_name = f"python{major_minor}"
|
||||||
which_python = shutil.which(python_name)
|
which_python = shutil.which(python_name)
|
||||||
if which_python is None:
|
if which_python is None:
|
||||||
|
|||||||
Reference in New Issue
Block a user