Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfc0f5b3

Browse files
committed
Build Pyodide wheel
Disable link flags to let Emscripten take over for SDL3Disable Py_LIMITED_API definition to workaround issue with cffiRelated to#123
1 parent9392a48 commitfc0f5b3

File tree

4 files changed

+40
-7
lines changed

4 files changed

+40
-7
lines changed

‎.github/workflows/python-package.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,33 @@ jobs:
321321
retention-days:7
322322
compression-level:0
323323

324+
pyodide:
325+
needs:[ruff, mypy, sdist]
326+
runs-on:ubuntu-24.04
327+
steps:
328+
-uses:actions/checkout@v4
329+
with:
330+
fetch-depth:${{ env.git-depth }}
331+
-name:Checkout submodules
332+
run:git submodule update --init --recursive --depth 1
333+
-uses:libsdl-org/setup-sdl@6574e20ac65ce362cd12f9c26b3a5e4d3cd31dee
334+
with:
335+
install-linux-dependencies:true
336+
build-type:"Debug"
337+
version:${{ env.sdl-version }}
338+
-uses:pypa/cibuildwheel@v3.0.0
339+
env:
340+
CIBW_PLATFORM:pyodide
341+
-name:Archive wheel
342+
uses:actions/upload-artifact@v4
343+
with:
344+
name:wheels-pyodide
345+
path:wheelhouse/*.whl
346+
retention-days:30
347+
compression-level:0
348+
324349
publish:
325-
needs:[sdist, build, build-macos, linux-wheels]
350+
needs:[sdist, build, build-macos, linux-wheels, pyodide]
326351
runs-on:ubuntu-latest
327352
if:github.ref_type == 'tag'
328353
environment:

‎.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,7 @@
350350
"pycall",
351351
"pycparser",
352352
"pyinstaller",
353+
"pyodide",
353354
"pypa",
354355
"PYPI",
355356
"pypiwin",

‎build_libtcod.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,12 @@ def walk_sources(directory: str) -> Iterator[str]:
162162

163163
libraries:list[str]= [*build_sdl.libraries]
164164
library_dirs:list[str]= [*build_sdl.library_dirs]
165-
define_macros:list[tuple[str,Any]]= [("Py_LIMITED_API",Py_LIMITED_API)]
165+
define_macros:list[tuple[str,Any]]= []
166+
167+
if"PYODIDE"notinos.environ:
168+
# Unable to apply Py_LIMITED_API to Pyodide in cffi<=1.17.1
169+
# https://github.com/python-cffi/cffi/issues/179
170+
define_macros.append(("Py_LIMITED_API",Py_LIMITED_API))
166171

167172
sources+=walk_sources("tcod/")
168173
sources+=walk_sources("libtcod/src/libtcod/")

‎build_sdl.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,9 @@ def get_cdef() -> tuple[str, dict[str, str]]:
350350
libraries:list[str]= []
351351
library_dirs:list[str]= []
352352

353-
354-
ifsys.platform=="darwin":
353+
if"PYODIDE"inos.environ:
354+
pass
355+
elifsys.platform=="darwin":
355356
extra_link_args+= ["-framework","SDL3"]
356357
else:
357358
libraries+= ["SDL3"]
@@ -382,6 +383,7 @@ def get_cdef() -> tuple[str, dict[str, str]]:
382383
extra_compile_args+= (
383384
subprocess.check_output(["pkg-config","sdl3","--cflags"],universal_newlines=True).strip().split()
384385
)
385-
extra_link_args+= (
386-
subprocess.check_output(["pkg-config","sdl3","--libs"],universal_newlines=True).strip().split()
387-
)
386+
if"PYODIDE"notinos.environ:
387+
extra_link_args+= (
388+
subprocess.check_output(["pkg-config","sdl3","--libs"],universal_newlines=True).strip().split()
389+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp