Skip to content

Improvements to the Emscripten buildbot#687

Merged
vstinner merged 3 commits intopython:mainfrom
hoodmane:emscripten-buildbot-improvements
Mar 20, 2026
Merged

Improvements to the Emscripten buildbot#687
vstinner merged 3 commits intopython:mainfrom
hoodmane:emscripten-buildbot-improvements

Conversation

@hoodmane
Copy link
Contributor

@hoodmane hoodmane commented Mar 19, 2026

  • Use the build script from its new Platform/emscripten/__main__.py location
  • Use python3 Platform/emscripten run to avoid hard coding build output path
  • Use new EMSDK_CACHE environment variable to allow build script to manage
    Emscripten installations
  • Build libmpdec
  • Cache libffi and libmpdec
  • Allow build script to manage node installations

python/cpython#146156 has to land first

* Use the build script from its new `Platform/emscripten/__main__.py` location
* Use `python3 Platform/emscripten run` to avoid hard coding build output path
* Use new `EMSDK_CACHE` environment variable to allow build script to manage
  Emscripten installations
* Build libmpdec
* Cache libffi and libmpdec
* Allow build script to manage node installations

python/cpython#146156 has to land first
@hoodmane hoodmane force-pushed the emscripten-buildbot-improvements branch from 96780ff to d8ed65b Compare March 19, 2026 08:53
@hoodmane hoodmane requested a review from freakboy3742 March 19, 2026 08:58
@vstinner
Copy link
Member

python/cpython#146156 has to land first

It landed, but its 3.14 backport didn't land yet: python/cpython#146159

@hoodmane
Copy link
Contributor Author

I guess we'll also want to merge and backport python/cpython#146158 and python/cpython#146160 first so we can move more configuration from here into the cpython repo.

Copy link
Contributor

@freakboy3742 freakboy3742 left a comment

Choose a reason for hiding this comment

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

One typo; but otherwise this looks good to me. All the upstream PRs have landed, including 3.14 backports; and I've manually tested the commands on the buildbot.

@vstinner vstinner merged commit f82a93f into python:main Mar 20, 2026
1 check passed
@hoodmane hoodmane deleted the emscripten-buildbot-improvements branch March 20, 2026 09:48
@vstinner
Copy link
Member

All the upstream PRs have landed, including 3.14 backports

Ok. I merged the PR (the new config will be deployed in a few minutes). Let's see how it goes :-)

@hoodmane
Copy link
Contributor Author

Thanks @vstinner!

@hoodmane
Copy link
Contributor Author

Well it is not quite right:
#688

@hoodmane
Copy link
Contributor Author

Looks working now:
https://buildbot.python.org/all/#/builders/1809/builds/108

@mhsmith
Copy link
Member

mhsmith commented Mar 24, 2026

Since this PR was merged, the Emscripten buildbot has posted some comments on GitHub in which the "traceback logs" appears to be the entire stderr of the build and test process:

These were brought to my attention because I have a filter set up for the word "Android", which shows up in the log because the Android test has been (correctly) skipped. I haven't had this happen with other buildbots.

Separately, the logs are a bit mangled both in the GitHub comment and the Buildbot web interface because they include ANSI color codes. The other buildbots don't do this either.

@hoodmane
Copy link
Contributor Author

Seems likely to be because the interpreter crashed? Presumably the bot looked for the pattern that it expects failing unittests to generate and didn't find it so instead it included all of stdout.

@mhsmith
Copy link
Member

mhsmith commented Mar 25, 2026

Yes, it looks like you're right, except it's stderr only. Maybe skip messages shouldn't be printed on stderr, but that's a separate discussion.

@hoodmane
Copy link
Contributor Author

On the other hand the color handling does seem to be unusual. It's unfortunate because I think the console view is more readable with color, but we probably should make the Emscripten buildbot do the typical thing.

An Ubuntu build bot

image

The Emscripten build bot

image

@mhsmith
Copy link
Member

mhsmith commented Mar 25, 2026

Even in the buildbot web interface, in this run the color codes stopped working half way through for some reason (the red is the web interface's default rendering of stderr):

Screenshot 2026-03-25 at 09 37 36

@hoodmane
Copy link
Contributor Author

That is odd. Do you have any idea how the colors are supposed to get disabled? None of the other build bots seem to explicitly disable them. I guess I should look at the unittest code that decides whether color is on or off.

@hoodmane
Copy link
Contributor Author

hoodmane commented Mar 25, 2026

can_colorize

    if not sys.flags.ignore_environment:
        if _safe_getenv("PYTHON_COLORS") == "0":
            return False
        if _safe_getenv("PYTHON_COLORS") == "1":
            return True
    if _safe_getenv("NO_COLOR"):
        return False
    if _safe_getenv("FORCE_COLOR"):
        return True
    if _safe_getenv("TERM") == "dumb":
        return False

    if not hasattr(file, "fileno"):
        return False

    try:
        return os.isatty(file.fileno())
    except OSError:
        return hasattr(file, "isatty") and file.isatty()
``


</p>
</details> 

@hoodmane
Copy link
Contributor Author

Well you can see that none of the environment variables are set from the listing, and it doesn't seem that an argument is passed to python -m test to turn off the colors. Maybe os.isatty(stdout) returns True on Emscripten and False in other buildbots?

@hoodmane
Copy link
Contributor Author

hoodmane commented Mar 25, 2026

Indeed in an ubuntu buildbot os.isatty(file.fileno()) is False but in the Emscripten buildbot os.isatty(file.fileno()) returns True.

$ python Platforms/emscripten/ run -- -c \
       'import sys; import os; print(os.isatty(sys.stdout.fileno()))' | cat
True

@hugovk
Copy link
Member

hugovk commented Mar 25, 2026

Setting a NO_COLOR=1 env var on this buildbot should disable it globally.

@hoodmane
Copy link
Contributor Author

Yeah though I'd rather fix the problem with streams. Pyodide handles this correctly, so it's just a matter of pulling in the right part of https://github.com/pyodide/pyodide/blob/main/src/js/streams.ts

Some day this stuff should go into Emscripten, but I've never gotten around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants