Skip to content

Commit

Permalink
fix: accept current Python version if acceptable for Pyodide (#1868)
Browse files Browse the repository at this point in the history
* fix: accept current Python version if acceptable for Pyodide

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Jun 11, 2024
1 parent 4ada77d commit 8d5d84e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ branding:
runs:
using: composite
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
id: python
with:
python-version: "3.8 - 3.12"
python-version: "3.12"
update-environment: false

- id: cibw
Expand Down
7 changes: 6 additions & 1 deletion cibuildwheel/pyodide.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import os
import shutil
import sys
from collections.abc import Sequence, Set
from dataclasses import dataclass
from pathlib import Path
Expand Down Expand Up @@ -92,7 +93,11 @@ def install_xbuildenv(env: dict[str, str], pyodide_version: str) -> str:
def get_base_python(identifier: str) -> Path:
implementation_id = identifier.split("-")[0]
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}"
which_python = shutil.which(python_name)
if which_python is None:
Expand Down

0 comments on commit 8d5d84e

Please sign in to comment.