-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
bpo-40280: Add build target for Emscripten/node.js #30495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This adds a "python.js" target to the Makefile. We enable the raw node fs mode as suggested by @thomasballinger as it will make running the test suite under node easier, c.f. emmatyping/python-wasm#36. The wasm_asset.py script is updated to include the test module. Care is taken to skip compiling the Python files that are examples of bad syntax or encoding. This also turns on memory growth as early into the test suite I was running into OOMs.
I'm unsure if this needs a NEWS entry, I'd be happy to add one if so. |
Co-authored-by: Christian Heimes <[email protected]>
@@ -38,6 +38,7 @@ CC= @CC@ | |||
CXX= @CXX@ | |||
MAINCC= @MAINCC@ | |||
LINKCC= @LINKCC@ | |||
LINKCC_BUILDPYTHON = @LINKCC_BUILDPYTHON@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the least intrusive way I could think of to customize the link step only for building the python.wasm
executable...
If you know of a better way, please do tell :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh! The ugly hacks are piling up. Maybe it's easier to not use ac_cv_pthread
and to add -pthread
to CFLAGS
or CFLAGS_NODIST
after all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately then it would be passed to the $(BUILDPYTHON)
target, and standalone wasm doesn't support -pthread
@@ -7926,7 +7927,7 @@ PyInit__socket(void) | |||
#ifdef IPPROTO_VRRP | |||
PyModule_AddIntMacro(m, IPPROTO_VRRP); | |||
#endif | |||
#ifdef IPPROTO_SCTP | |||
#if defined(IPPROTO_SCTP) && !defined(__EMSCRIPTEN__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a better way to deal with the issue. I guess you did the same mistake as I and added the skipif
call after the check for AIX? That doesn't work because @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
tries to create an IPPROTO_SCTP
socket and decorators are executed in reverse order!
This works:
--- a/Lib/test/test_socket.py
+++ b/Lib/test/test_socket.py
@@ -43,6 +43,7 @@
VSOCKPORT = 1234
AIX = platform.system() == "AIX"
+EMSCRIPTEN = sys.platform == "Emscripten"
try:
import _socket
...
@requireAttrs(socket.socket, "sendmsg")
[email protected](AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
@requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
[email protected](AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
[email protected](EMSCRIPTEN, "IPPROTO_SCTP: aborts on Emscripten")
class SendmsgSCTPStreamTest(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you've opened #30538 so I'll remove this change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#30538 does not work ... it's still running the decorator and crashing node.js
@@ -38,6 +38,7 @@ CC= @CC@ | |||
CXX= @CXX@ | |||
MAINCC= @MAINCC@ | |||
LINKCC= @LINKCC@ | |||
LINKCC_BUILDPYTHON = @LINKCC_BUILDPYTHON@ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Meh! The ugly hacks are piling up. Maybe it's easier to not use ac_cv_pthread
and to add -pthread
to CFLAGS
or CFLAGS_NODIST
after all?
Co-authored-by: Christian Heimes <[email protected]>
Co-authored-by: Christian Heimes <[email protected]>
Co-authored-by: Christian Heimes <[email protected]>
Co-authored-by: Christian Heimes <[email protected]>
I think the important bits of this ended up in #30552 so this can be closed. |
This adds a "python.js" target to the Makefile. We enable the raw
node.js filesystem mode as suggested by @thomasballinger as it will make running
the test suite under node easier, c.f.
emmatyping/python-wasm#36.
The
wasm_asset.py
script is updated to include thetest
module. Care istaken to skip compiling the Python files that are examples of bad syntax
or encoding.
This also turns on memory growth as early into the test suite I was
running into OOMs.
cc @tiran
This requires my other PR to work of course #30494(This is now merged)https://bugs.python.org/issue40280