Skip to content

Commit

Permalink
pygame-ce 2.5.0.dev3 (SDL 2.28.4, Python 3.13.0b1)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed May 31, 2024
1 parent fc97700 commit 585d607
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 25 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
runs-on: ubuntu-22.04
env:
SDK_VERSION: 3.1.60.0bi
SDK_VERSION: 3.1.61.0bi
SYS_PYTHON: /usr/bin/python3
PACKAGES: emsdk hpy pygame
BUILD_STATIC: emsdk hpy
Expand Down
20 changes: 18 additions & 2 deletions packages.d/pygame/pygame.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ else

# update cython
TEST_CYTHON=$($HPY -m cython -V 2>&1)
if echo $TEST_CYTHON| grep -q 3.0.1$
if echo $TEST_CYTHON| grep -q 3.0.10$
then
echo " * not upgrading cython $TEST_CYTHON
" 1>&2
else
echo " * upgrading cython $TEST_CYTHON to 3.0.1
echo " * upgrading cython $TEST_CYTHON to 3.0.10
" 1>&2
#$SYS_PYTHON -m pip install --user --upgrade git+https://github.com/cython/cython.git
CYTHON=${CYTHON:-Cython-3.0.10-py2.py3-none-any.whl}
Expand Down Expand Up @@ -77,6 +77,9 @@ then
pushd $(pwd)/pygame-wasm
fi

# to upstream after tests
# done wget -O- https://patch-diff.githubusercontent.com/raw/pmp-p/pygame-ce-wasm/pull/7.diff | patch -p1

#unsure
wget -O- https://patch-diff.githubusercontent.com/raw/pmp-p/pygame-ce-wasm/pull/3.diff | patch -p1

Expand Down Expand Up @@ -167,6 +170,19 @@ index e33eae33..f5f6697e 100644
END

if echo $PYBUILD|grep -q 3.13$
then
echo "
============================================
Forcing cython regen for 3.13+
============================================
"
rm src_c/_sdl2/sdl2.c src_c/_sdl2/audio.c src_c/_sdl2/mixer.c src_c/_sdl2/controller_old.c src_c/_sdl2/video.c
fi

else
pushd $(pwd)/pygame-wasm
Expand Down
9 changes: 6 additions & 3 deletions scripts/build-loader.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,10 @@ then
LDFLAGS="$LDFLAGS $cpylib"
done


LDFLAGS="$LDFLAGS $(cat $LNK_TEST) -lembind"


echo "
LDFLAGS=$LDFLAGS
Expand Down Expand Up @@ -327,9 +331,8 @@ emcc \\
--preload-file ${DYNLOAD}@/usr/lib/python${PYBUILD}/lib-dynload \\
--preload-file ${REQUIREMENTS}@/data/data/org.python/assets/site-packages \\
-o ${DIST_DIR}/${DISTRO}${PYMAJOR}${PYMINOR}/${MODE}.js build/${MODE}.o \\
$LDFLAGS \\
$(cat $LNK_TEST) \\
-lembind
$LDFLAGS
END
chmod +x ./final_link.sh
Expand Down
4 changes: 4 additions & 0 deletions src/pygbag/optimizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"wav": "ogg",
"bmp": "png",
"mp3": "ogg",
"xm" : "ogg",
}


Expand Down Expand Up @@ -86,6 +87,9 @@ def translated(fn):
if fp.suffix == ".mp3":
...

if fp.suffix == ".xm":
...

if fp.suffix == ".wav":
...

Expand Down
11 changes: 7 additions & 4 deletions src/pygbag/support/cross/aio/pep0723.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ async def async_repos():
rewritecdn = "http://localhost:8000/archives/repo/"

if rewritecdn:
print(f"""230: {platform.window.location.href} {rewritecdn=}""")
print(f"""230: {rewritecdn=}""")
for idx, repo in enumerate(Config.pkg_repolist):
repo["-CDN-"] = rewritecdn

Expand Down Expand Up @@ -277,9 +277,9 @@ async def pip_install(pkg, sysconf={}):
for repo in Config.pkg_repolist:
if pkg in repo:
wheel_url = f"{repo['-CDN-']}{repo[pkg]}#"

# try to get a pure python wheel from pypi
if not wheel_url:
break
else:
# try to get a pure python wheel from pypi
try:
async with fopen(f"https://pypi.org/simple/{pkg}/") as html:
if html:
Expand All @@ -305,6 +305,9 @@ async def pip_install(pkg, sysconf={}):
HISTORY.append(pkg)
except:
print("324: INVALID", pkg, "from", wheel_url)
else:
print(f"309: no provider found for {pkg}")


PYGAME = 0

Expand Down
4 changes: 1 addition & 3 deletions static/default.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
print("""
Loading {{cookiecutter.title}} from {{cookiecutter.archive}}.apk
Pygbag Version : {{cookiecutter.version}}
Template Version : 0.9.0
Template Version : 0.9.1
Python : {{cookiecutter.PYBUILD}}
CDN URL : {{cookiecutter.cdn}}
Screen : {{cookiecutter.width}}x{{cookiecutter.height}}
Expand Down Expand Up @@ -259,8 +259,6 @@ config = {
<link rel="prefetch" href="{{cookiecutter.cdn}}pythonrc.py">
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm.js">
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm-addon-image.js">
<link rel="prefetch" href="{{cookiecutter.cdn}}vt/xterm-addon-image.js">


<link rel="icon" type="image/png" href="favicon.png" sizes="16x16">

Expand Down
18 changes: 6 additions & 12 deletions support/__EMSCRIPTEN__.c
Original file line number Diff line number Diff line change
Expand Up @@ -1072,13 +1072,13 @@ main(int argc, char **argv)


EM_ASM({
const FD_BUFFER_MAX = $0;
const shm_stdin = $1;
const shm_rawinput = $2;
const shm_rcon = $3;
globalThis.FD_BUFFER_MAX = $0;
globalThis.shm_stdin = $1;
globalThis.shm_rawinput = $2;
globalThis.shm_rcon = $3;

Module.printErr = Module.print;
const is_worker = (typeof WorkerGlobalScope !== 'undefined') && self instanceof WorkerGlobalScope;
globalThis.is_worker = (typeof WorkerGlobalScope !== 'undefined') && self instanceof WorkerGlobalScope;

function jswasm_load(script, aio) {
if (!aio) aio=false;
Expand Down Expand Up @@ -1135,17 +1135,11 @@ EM_ASM({
} else {
console.error("PyMain: BrowserFS not found");
}
if ($4) {
SYSCALLS.getStreamFromFD(0).tty = true;
SYSCALLS.getStreamFromFD(1).tty = true;
SYSCALLS.getStreamFromFD(2).tty = false;
}
}
}


}, FD_BUFFER_MAX, io_shm[0], io_shm[IO_RAW], io_shm[IO_RCON], CPY);

}, FD_BUFFER_MAX, io_shm[0], io_shm[IO_RAW], io_shm[IO_RCON]);

PyRun_SimpleString("import sys, os, json, builtins, time");
PyRun_SimpleString("sys.ps1 = ''");
Expand Down

0 comments on commit 585d607

Please sign in to comment.