Skip to content

Commit 8d5d84e

Browse files
authored
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>
1 parent 4ada77d commit 8d5d84e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

action.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ branding:
2424
runs:
2525
using: composite
2626
steps:
27-
# Set up a non-EOL, cibuildwheel & pipx supported Python version
27+
# Set up the version of Python that supports pyodide
2828
- uses: actions/setup-python@v5
2929
id: python
3030
with:
31-
python-version: "3.8 - 3.12"
31+
python-version: "3.12"
3232
update-environment: false
3333

3434
- id: cibw

cibuildwheel/pyodide.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
import shutil
5+
import sys
56
from collections.abc import Sequence, Set
67
from dataclasses import dataclass
78
from pathlib import Path
@@ -92,7 +93,11 @@ def install_xbuildenv(env: dict[str, str], pyodide_version: str) -> str:
9293
def get_base_python(identifier: str) -> Path:
9394
implementation_id = identifier.split("-")[0]
9495
majorminor = implementation_id[len("cp") :]
95-
major_minor = f"{majorminor[0]}.{majorminor[1:]}"
96+
version_info = (int(majorminor[0]), int(majorminor[1:]))
97+
if version_info == sys.version_info[:2]:
98+
return Path(sys.executable)
99+
100+
major_minor = ".".join(str(v) for v in version_info)
96101
python_name = f"python{major_minor}"
97102
which_python = shutil.which(python_name)
98103
if which_python is None:

0 commit comments

Comments
 (0)