FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-40280: Add build target for Emscripten/node.js by emmatyping · Pull Request #30495 · python/cpython · GitHub

/ cpython Public

bpo-40280: Add build target for Emscripten/node.js - #30495

Closed
emmatyping wants to merge 11 commits into
python:mainfrom
emmatyping:nodejs
Closed

bpo-40280: Add build target for Emscripten/node.js#30495
emmatyping wants to merge 11 commits into
python:mainfrom
emmatyping:nodejs

Conversation

emmatyping commented Jan 9, 2022
edited
Loading

Copy link
Copy Markdown
Member

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 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.

cc @tiran

This requires my other PR to work of course #30494 (This is now merged)

https://bugs.python.org/issue40280

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.

Copy link
Copy Markdown
Member Author

I'm unsure if this needs a NEWS entry, I'd be happy to add one if so.

Comment thread Makefile.pre.in Outdated
Comment thread Tools/wasm/wasm_assets.py Outdated
Co-authored-by: Christian Heimes <christian@python.org>
Comment thread Makefile.pre.in
CXX= @CXX@
MAINCC= @MAINCC@
LINKCC= @LINKCC@
LINKCC_BUILDPYTHON = @LINKCC_BUILDPYTHON@

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 :)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Unfortunately then it would be passed to the $(BUILDPYTHON) target, and standalone wasm doesn't support -pthread

Comment thread Makefile.pre.in Outdated
Comment thread Modules/socketmodule.c Outdated
Comment thread Modules/socketmodule.c
PyModule_AddIntMacro(m, IPPROTO_VRRP);
#endif
#ifdef IPPROTO_SCTP
#if defined(IPPROTO_SCTP) && !defined(__EMSCRIPTEN__)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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")
-@unittest.skipIf(AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
 @requireSocket("AF_INET", "SOCK_STREAM", "IPPROTO_SCTP")
+@unittest.skipIf(AIX, "IPPROTO_SCTP: [Errno 62] Protocol not supported on AIX")
+@unittest.skipIf(EMSCRIPTEN, "IPPROTO_SCTP: aborts on Emscripten")
 class SendmsgSCTPStreamTest(SendmsgStreamTests, SendrecvmsgSCTPStreamTestBase):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I see you've opened #30538 so I'll remove this change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

#30538 does not work ... it's still running the decorator and crashing node.js

Comment thread Makefile.pre.in
CXX= @CXX@
MAINCC= @MAINCC@
LINKCC= @LINKCC@
LINKCC_BUILDPYTHON = @LINKCC_BUILDPYTHON@

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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?

Comment thread Makefile.pre.in Outdated
Comment thread Makefile.pre.in Outdated
emmatyping and others added 4 commits January 11, 2022 09:15
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Christian Heimes <christian@python.org>
Co-authored-by: Christian Heimes <christian@python.org>
brettcannon self-requested a review January 12, 2022 01:08

Copy link
Copy Markdown
Member Author

I think the important bits of this ended up in #30552 so this can be closed.

This file contains hidden or 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL