forked from pygame-web/pygbag
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pygame-web:main' into main
- Loading branch information
Showing
97 changed files
with
13,371 additions
and
1,951 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
open_collective: pythonseverywhere | ||
liberapay: pmp-p | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,17 +6,17 @@ jobs: | |
build: | ||
runs-on: ubuntu-22.04 | ||
env: | ||
SDK_VERSION: 3.1.46.2bi | ||
SDK_VERSION: 3.1.54.1bi | ||
SYS_PYTHON: /usr/bin/python3 | ||
PACKAGES: emsdk hpy _ctypes pygame | ||
BUILD_STATIC: emsdk _ctypes hpy | ||
PACKAGES: emsdk hpy pygame | ||
BUILD_STATIC: emsdk hpy | ||
STATIC: false | ||
BUILDS: 3.11 3.12 | ||
CYTHON: Cython-3.0.1-py2.py3-none-any.whl | ||
BUILDS: 3.11 3.12 3.13 | ||
CYTHON: Cython-3.0.8-py2.py3-none-any.whl | ||
LD_VENDOR: -sUSE_GLFW=3 | ||
|
||
steps: | ||
- uses: actions/checkout@v3.3.0 | ||
- uses: actions/checkout@v4.1.0 | ||
- name: pygame-wasm-builder prepare | ||
run: | | ||
pwd | ||
|
@@ -40,29 +40,58 @@ jobs: | |
- name: build 3.11 packages | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYBUILD=3.11 bash ./scripts/build-pkg.sh | ||
PYBUILD=3.11 PACKAGES="emsdk hpy _ctypes pygame" BUILD_STATIC="emsdk _ctypes hpy" bash ./scripts/build-pkg.sh | ||
- name: build 3.11 loader | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYBUILD=3.11 bash ./scripts/build-loader.sh | ||
# - name: build 3.12 packages | ||
# run: | | ||
# cd $GITHUB_WORKSPACE | ||
# PYBUILD=3.12 bash ./scripts/build-pkg.sh | ||
# | ||
# - name: build 3.12 loader | ||
# run: | | ||
# cd $GITHUB_WORKSPACE | ||
# PYBUILD=3.12 bash ./scripts/build-loader.sh | ||
# | ||
PYBUILD=3.11 PACKAGES="emsdk hpy _ctypes pygame" BUILD_STATIC="emsdk _ctypes hpy" bash ./scripts/build-loader.sh | ||
- name: build 3.12 packages | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYBUILD=3.12 bash ./scripts/build-pkg.sh | ||
- name: build 3.12 loader | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYBUILD=3.12 bash ./scripts/build-loader.sh | ||
- name: build 3.13 packages | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYBUILD=3.13 bash ./scripts/build-pkg.sh | ||
- name: build 3.13 loader | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
PYBUILD=3.13 bash ./scripts/build-loader.sh | ||
- name: build PkPy loader | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
bash ./scripts/build-pkpy.sh | ||
- name: publishing | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
echo "<html></html>" > build/web/archives/index.html | ||
- name: make wheel | ||
run: | | ||
cd $GITHUB_WORKSPACE | ||
/opt/python-wasm-sdk/python3-wasm -m build --no-isolation . | ||
- name: Upload sdk to Github Releases | ||
if: github.event_name == 'release' | ||
uses: svenstaro/[email protected] | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: $GITHUB_WORKSPACE/dist/* | ||
file_glob: true | ||
tag: ${{ github.ref }} | ||
|
||
|
||
- name : "Upload to GitHub pages" | ||
uses: JamesIves/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
recursive-include src/pygbag/support * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Pq"1;1;70;91#0;2;97;97;97#1;2;82;82;82#2;2;88;88;88#3;2;41;41;41#4;2;78;78;78#5;2;72;72;72#6;2;56;56;56#7;2;53;53;53#8;2;91;91;91#9;2;66;66;66#10;2;44;44;44#11;2;75;75;75#12;2;47;47;47#13;2;63;63;63#14;2;94;94;97#15;2;78;85;88#16;2;75;78;85#17;2;69;75;82#18;2;56;66;75#19;2;50;60;72#20;2;38;56;72#21;2;66;72;75#22;2;94;97;97#23;2;88;91;94#24;2;53;63;75#25;2;31;50;69#26;2;22;44;63#27;2;25;44;60#28;2;35;50;63#29;2;85;88;91#30;2;82;85;88#31;2;19;41;60#32;2;38;53;66#33;2;91;94;94#34;2;25;47;66#35;2;60;69;78#36;2;25;44;63#37;2;97;97;94#38;2;97;97;91#39;2;97;88;66#40;2;97;82;28#41;2;97;82;41#42;2;97;91;72#43;2;35;53;72#44;2;97;78;25#45;2;97;88;63#46;2;97;94;82#47;2;56;69;78#48;2;97;85;47#49;2;97;91;78#50;2;63;69;75#51;2;97;82;31#52;2;97;78;22#53;2;97;82;38#54;2;78;82;85#55;2;75;82;88#56;2;97;97;88#57;2;56;63;69#58;2;28;41;53#59;2;88;88;91#60;2;41;50;60#61;2;72;75;78#62;2;47;53;63#63;2;50;56;66#64;2;66;69;75#65;2;53;60;69#66;2;35;47;56#67;2;63;66;72#68;2;72;75;82#69;2;25;41;50#70;2;31;41;53#71;2;63;69;72#72;2;50;60;66#73;2;75;78;82#0!34~NFF!33~$#2!34?o?G$#1!35?G#4o$#3!35?o-#0!7~NF!4fFN^~FFF!4~FFF~f??ff~???FffFFN~~NNFfffFN^~NN!4fFFN!6~$#10!7?_O#9O???_!4?G!6?G??G??G!4?_?OGG!9?W!4?_??G??G$#11!7?O#2G??O???_???G!6?o!5?O?~!6?G!9?G!7?O??G$#13!8?_#5G??O?O#8??G!8?G#4?O??O!4?N?GO!8?O???O!4?G??O_?_$#1!10?O!6?o?o!4?G#7!4?ee!5?OO!8?O??G!6?O???G$#6!10?G?G#3O_???o!6?o!9?~!5?O#1O!6?O!5?O??O#6G$#7!11?G#4?G#11!10?o!7?G#8!4?g??_!4?O?_!5?_!9?O$#10!29?GG!10?_!9?O_!8?OO$#12!29?OO#13!14?_!5?_!5?O$#5!29?@#6@!9?O?_!4?OG#3!7?_!5?_$#12!46?_#5G-#0!7~??!4~???~???!4~???~~??~~~???!4~??~_??^~~~C?_~??!4~???!6~$#10!7?~!6?_#11P!8?^#7!4?^^#4!5?~!7?C?M!6?O!9?~$#6!8?_!4?_?C???_!9?_#12_#6!10?@!9?_?C$#13!8?^!6?I#9!8?_#13!16?}!4?O!6?A$#2!13?M???_!8?~!7?~!9?@??_???G!9?~$#1!13?@???^?N#10!22?~??O#7!6?_#9G?~$#4!13?O!5?O#1!24?I!6?P#11?@$#3!14?^???~!6?~!9?~!9?N_!5?^???~!5?~$#8!15?_!28?O!6?A$#5!45?_@-#0!7~??!5{}~~~}{[[[K?_{~~}{{{~{{{!4~{{~~~}!4{}}~~{{!4~}{{!6~$#10!7?~!5?@!9?_@#8?A!7?A?A#13!4?@#10@#9???@!8?@#3@!5?@$!8?@#2A???A!5?A_??A??@???A?@?@!6?A#1!5?A??A#8?@#2??A!5?@?A$#13!8?}#12@#4A???@!7?AOEO!6?A??A@!5?A!6?@!6?A!5?A@$#9!10?@A#11A!7?A???_!6?A#12!15?@#5@A#6@@$#5!11?@!6?@??b#9@?G!6?@#11!16?A$#7!12?@!7?@??@?G#1???@$#3!19?@!4?OF!4?@!4?@$#6!22?_-#0!7~}}!11~!4}~^NN!14FN^!26~$#1!7?@#4@#2!11?@#11@#1@#8@#29?_#25_?O#15G#16G!8?G#27O?_#24_$#23!26?O#26__!11o__#17O$#24!27?O#14G#17??G#18G!4?G#21G#15?G#22G$#19!33?G??G#28!4?O$#20!34?GG-#0!24~B???EEC#27!12?@{#0B!24~$#33!24?{#25A?@?O?A#31!11?}#17@#14C$#34!25?{??O#22GA#32!13?A#23w$#19!25?@#26~o__ox!11~$#32!27?G???C$#17!27?A@?G$#16!27?C#23G#30@#18@-#0!15~NFBBB!4@#26!11w{!7~#31~#27~#23~#0!5@BBFN!15~$#33!15?O!5?!13A#23A#36@#37!10?A???A#41C#42C#45G#46O$#47!15?_#34_owww{{{!11CA#39!10?{#44!6wo#48_$#43!16?OG#17C#20C#22A#35!4?!10@#40!12?!4C$#23!16?G#14C!6?@#38!22?AAA$#25!20?C-#0!14~#15A#34}!8~#26~~~!13^NNN#8O#51_?C#52!7?{#38@#0!14~$#17!14?C#25@!11?_#18_#16!11_#27OO??@#39G!9?C$#19!14?G#54!25?_#23_#37_??C#48A!8?G$#20!14?O#24!27?O#31F#14G#40O!9?_$#33!14?@#32!28?G#28A#44_w!7~B#49A$#43!14?_#42!28?_#46O#0A#45@#53!8?O$#50!44?C#33@-#0!14~#35G!8?_??@#46???!11@#44}}!11~o#38_#0}!13~$#19!14?C#34!8~FA@#51w{{!9}AAA#42@#48@#52!11?N#40B#37@$#20!14?A#24!8?O#38_!4?@#40!8?{{{#42!14?O$#33!14?_#25!8?G#14G??@#48!27?G$#43!14?@#0!9?O#37CA?@#53!26?C$#55!14?O#26!9?@#41_??A$#47!24?C#42G?A$#16!25?A#45C$#48!25?O-#0!15~{woo!5_#38~#53~#51!9~NNN!5G#37??_!5?O?G#48@$#15!15?A#35C!6?F#46!11?!16O???A$#19!15?@#34BFF!4N#33O#49!11?!10_#0?!6_oo{!15~$#17!17?G!5?G#40!14?FFF#44FF!8NFFB$#43!18?G#23O#30OOO#40!28?G#45GC-#0!24~o#42_#51!12~d?AAC$#38!24?N#48O#40!12?AB@???N$#53!25?N#41!12?W???_?O$#0!39?OWW???o!24~$#39!39?c!4?_$#37!39?G#38_!4?N$#56!40?C#44@B~$#46!41?_#42W$#49!41?C-#0!26~}{!4w!6o!4w{}!18~NN!6~$#45!26?@#51@@BBB!6F?@B@#42A#57!19?O#30o$#49!27?A#48A??C!6?C!4?@#58!18?_$#37!28?C!8?G???C#44@$#46!29?C#39C!8?C#46C#41A$#38!32?GG??G#40?BA$#56!34?GG-#0!7~FBrrbBN~NFbrrFF^bBN~NBBN~FB~FFRRBF^~FFrrr^FBRRFN~NFbrrb??!6~$#66!7?o!4?O#65??_???G!9?G#14O?G!6?C#63O!4?G!7?G_#66??_G#64GG#8C#69G#30F$#16!7?Go?C#14O#63G#21???G#23S??_???CO???C!7?__#60G???OG!4?OG??O!7?G$!8?G!4?_???G??GO#33?C#62G!8?G??G#68??_#59G!6?K#58?_!7?O!4?v$#22!8?C???C#70???O#64?G!4?G!9?O!4?GO!4?O#16?C???O!7?OC#33?O$#30!9?C?C???O???C??_O???O!5?C???CC!9?_??CC#61?O#68??G$#57!9?G??_#72???_#54?C#71?O#58_??O#68_#61?_#70Oo!5?_!4?_#22_#29?G?C???G#54_!9?C??w$#61!10?G??O#59!7?G#66??_???G#16?_#67?_??OOG!8?G#14???C#23__???O?C$#62!11?G#21!16?_!7?_#66!6?_#73_#21!6?G!4?_$#8!28?C#54???O_#33?G#57!16?G_-#0!7~??fnf_o}o_fnf`ow~{_`o}w_`o~}o_emeeu~__~~~w__!4e~w_bnffoo!6~$#66!7?~!8?C!8?C#69G!4?G#68C!7?G#22G!7?O??G!7?G#68O#58F#54F$#57!8?O!7?AO!8?O#61C#23@???G#8?@#63?@??O#14?@!8?A!7?C$#65!8?GO#60O!4?@G#33??GA#16?@!6?A!6?O???O!7?@!5?G?C!4?G$!8?f#59G#62?OCC?A??O!6?@?B!9?O#57?@#65???O#73N#23???C??G!5?O!5?G$#68!11?G!8?O#71???@#28?C#65??@H?A#64???C#59??G#66???N#58!5?E#60GOO!4?I!4?G$#54!12?O!9?A???A???OA???GAG!6?O???A#69@#57@??P??@?O?O$#58!12?G!8?B???A!9?B#71!13?G#30C??GO#62??@?O$#64!12?A!4?G???G#14!7?C#60?C@??C??O#64!11?O#67@@???A?G$#21!12?@#70B!7?C!8?E!5?G#50!17?@#70??C$#30!13?G!6?C???AO?G$#22!14?@#14G#67@!8?G!5?O!5?@@?@$#61!15?C#8O!5?C$#63!19?OG-#0!7~ww!61~$#66!7?B#16B$#71!7?C#54C-#0!70@\ |
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
P0;0;0q"1;1;128;128#0;2;0;0;0#1;2;14;15;16#2;2;48;43;18#3;2;19;31;44#4;2;72;60;9#5;2;91;79;28#6;2;27;43;61#7;2;55;63;73#8;2;98;98;96#0!128~-!128~-!14~^NNN!47FNNN^!59~$#3!14?_ooo!47wooo_-#0!10~NF@#6??_oo!46woo_#0???@BF^!54~$#3!10?ow}~~^NN!46FNN^~~~}{w_-#0!8~B#6!5?}!52~}#0!6?@!53~$#3!8?{!5~@!52?@!6~#1}-#0!8~#3!6~#6!15~B@!13?!5@BBFN^!14~#3!6~#1~#0!53~$#7!29?C?!13@???AA?CGO_$#8!29?w!17}{{{wo_-#0!8~#3!6~#6!15~!6?}!7~!4}{w!5?@!13~#3!6~#1~#0!53~$#8!29?!6~#7@!7?@@@?AC_!4?E$#8!46?@@B^!4~w-#0!8~#3!6~#6!15~!6?N!6^!5NFB!5?o~^NNFFF!6B#3!6B#1B#0B!35FNN^!14~$#8!29?!6~!11_oow!4~^B#2?_O?G??!14C!34?G$#7!35?O!6?!4O?GC!4?_K#4??_oo!50wooo_-#0!8~#3!6~#6!15~!6?!8_!6oww{}F@#5!4?_o!49wo_#0???@BN!10~$#8!29?!6~!12NFFFB@#4?o{}~~~^N!49FN^~~~}w_$#7!35?!8O!4?GG?CA@#2GA@!60?CO-#0!8~#3!6~#6!15~!6?!17~#2~#4!5~@!53?!6~#1@w$#8!29?!6~#5!23?}!53~#2!6?}#0F!8~-!8~#3!6~#6!15~w!4ow!17~#2~#4!5~#5!15~F@???@!9~^NFB@???_p!14~#4!6~#2~#1~#0!8~$#7!29?CG??GC#8!38?w}~~~}!9?_ow{}~~~^M$!29?BFNNFB-#0!8~#3!6~_#2!37?~#4!5~#5!15~!6?!4~^NFB@??_ow{}!17~#4!6~#2~#1~#0!8~$#6!14?^!37~#8!21?!6~!4?_ow{}~~^NFB@-#0!9~wo#6!4?@B!35F#2~#4!5~#5!15~!6?BB@!6?M^!22~#4!6~#2~#1~#0!8~$#3!9?FN!4~}{!35w#8!21?!6~{{}!6~p_-#0!12~}{woo!35_#2~#4!5~#5!15~!6?ow{}~}wo_???@FN^!17~#4!6~#2~#1~#0!8~$#3!12?@@BB!36F#8!21?!6~NFB@?@FN^~~~}wo_$#1!13?ACKG!35W-#0!52~#2~#4!5~#5!15~!6?!10~{wo_???BFN!13~#4!6~#2~#1~#0!8~$#8!73?!6~!10?BFN^~~~{wo-#0!52~#2~#4!5~#5!16~{www{!14~}{www{!13~#4!6~#2~#1~#0!8~$#8!74?BFFFB!14?@BFFFB-#0!52~o#4!5~o!52?_!6~#1o~#0!8~$#2!52?N#5!5?N!52~^#2!6?N-#0!53~{w_#5!4?@!49B@#2???_OCB$#4!53?@FN^~~~}!49{}~~~^NB#3G$#2!53?A?O_#1!58?_WCB$#0!116?_o{!9~-!57~}{ww!52ow{!13~$#2!57?@?A??!47C?AA@$#1!58?ACCK!47GKKKEB@$#4!58?@@!50B@@#3GCA-#0!128~-!128~-!128B-\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import sys | ||
|
||
final = [] | ||
with open(sys.argv[-1], "r") as source: | ||
ml = False | ||
for line in source.readlines(): | ||
if line.rstrip().endswith('"""'): | ||
ml = True | ||
final.append(line.replace('"""', "")) | ||
continue | ||
|
||
if ml: | ||
if line.lstrip().startswith('"""'): | ||
ml = False | ||
final.append(line.replace('"""', "")) | ||
continue | ||
if line and line[0] != "/": | ||
escaped = line.rstrip().replace('"', '\\"') | ||
final.append(f'"{escaped}\\n"\n') | ||
continue | ||
|
||
final.append(line) | ||
|
||
print("".join(final)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#define MODULE_NAME "embed" | ||
|
||
PyObject * | ||
PyInit_embed() { | ||
PyObject *mod = vm->new_module(MODULE_NAME); | ||
if (!mod) { | ||
puts("PyInit_" MODULE_NAME " : module not allocated"); | ||
return NULL; | ||
} | ||
|
||
vm->bind(mod, "readline() -> str", [](VM * vm, ArgsView argv) { | ||
return embed_readline(PyNULL, PyNULL);} | ||
); | ||
|
||
vm->bind(mod, "stdin_select() -> int", [](VM * vm, ArgsView argv) { | ||
return embed_stdin_select(PyNULL, PyNULL); | ||
}); | ||
|
||
vm->bind(mod, "os_read() -> bytes", [](VM * vm, ArgsView argv) { | ||
return embed_os_read(PyNULL, PyNULL); | ||
}); | ||
|
||
vm->bind(mod, "emscripten_cancel_main_loop() -> None", [](VM * vm, ArgsView argv) { | ||
emscripten_cancel_main_loop(); Py_RETURN_NONE; | ||
}); | ||
|
||
vm->bind(mod, "_new_module(name:str, code:str) -> None", [](VM * vm, ArgsView argv) { | ||
Str & name = py_cast < Str & >(vm, argv[0]); | ||
Str & code = py_cast < Str & >(vm, argv[1]); | ||
vm->_lazy_modules[name] = code; | ||
Py_RETURN_NONE; | ||
}); | ||
|
||
//_CAST(Str&, vm->py_str(argv[0])).c_str()); | ||
|
||
#if defined(__EMSCRIPTEN__) | ||
vm->bind(mod, "jseval(js: str='') -> Any",[](VM * vm, ArgsView argv) { | ||
Str & js = py_cast < Str & >(vm, argv[0]); | ||
char *json = (char *)EM_ASM_PTR({ | ||
try { | ||
const toeval = UTF8ToString($0); | ||
var result = null; | ||
const evalue = eval(toeval); | ||
if (evalue instanceof Function) { | ||
result = "[native code]"; | ||
} else { | ||
if (evalue === undefined) { | ||
result = null; | ||
} | ||
else { | ||
result = evalue; | ||
} | ||
} | ||
} catch(x) { | ||
result = (`Exception(${x})`); | ||
} | ||
return stringToNewUTF8(JSON.stringify(result)); | ||
}, js.c_str()); | ||
|
||
PyObject * json_loads = vm->_modules["json"]->attr("loads"); | ||
PyObject * result = vm->call(json_loads, py_var(vm, std::string_view(json))); | ||
free(json); | ||
return result; | ||
}); | ||
|
||
#else | ||
vm->bind(mod, "jseval(js: str='') -> str",[](VM * vm, ArgsView argv) { | ||
Str & js = py_cast < Str & >(vm, argv[0]); | ||
emscripten_run_script(js.c_str()); | ||
return py_var(vm, js); | ||
}); | ||
#endif | ||
|
||
vm->bind(mod, "is_browser() -> int",[](VM * vm, ArgsView argv) { | ||
#if defined(__EMSCRIPTEN__) | ||
int test_result = EM_ASM_INT({ | ||
return console.vm.is_browser; | ||
}); | ||
#else | ||
int test_result = 0; | ||
#endif | ||
return py_var(vm, test_result); | ||
}); | ||
return mod; | ||
} | ||
|
||
#undef MODULE_NAME | ||
|
||
|
||
#if PK_ENABLE_OS | ||
#else | ||
#define MODULE_NAME "os" | ||
|
||
PyObject * | ||
PyInit_os() { | ||
PyObject *mod = vm->new_module(MODULE_NAME); | ||
if (!mod) { | ||
puts("PyInit_" MODULE_NAME " : module not allocated"); | ||
return NULL; | ||
} | ||
|
||
vm->bind(mod, "read() -> bytes",[](VM * vm, ArgsView argv) { | ||
return embed_os_read(PyNULL, PyNULL); | ||
}); | ||
|
||
return mod; | ||
} | ||
|
||
#undef MODULE_NAME | ||
#endif | ||
|
||
|
Oops, something went wrong.