Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion master/custom/builders.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
WindowsARM64ReleaseBuild,
Wasm32WasiCrossBuild,
Wasm32WasiPreview1DebugBuild,
Wasm32WasiPlatformDebugBuild,
IOSARM64SimulatorBuild,
AndroidBuild,
EmscriptenBuild,
Expand Down Expand Up @@ -281,7 +282,8 @@ def generate_builderdefs(tags, entries):
("x86-64 MacOS Intel ASAN NoGIL", "itamaro-macos-intel-aws", MacOSAsanNoGilBuild),

# WASI
("wasm32-wasi", "bcannon-wasi", Wasm32WasiPreview1DebugBuild),
("wasm32-wasip1", "bcannon-wasi", Wasm32WasiPreview1DebugBuild),
("wasm32-wasi", "bcannon-wasi", Wasm32WasiPlatformDebugBuild),

# Windows aarch64 MSVC
("ARM64 Windows", "ware-win11-arm64", WindowsARM64Build),
Expand Down
120 changes: 114 additions & 6 deletions master/custom/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from buildbot.plugins import util

from . import JUNIT_FILENAME
from .branches import BRANCHES
from .branches import BRANCHES, BranchSet
from .steps import (
Test,
Clean,
Expand Down Expand Up @@ -976,9 +976,10 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs):
super().setup(branch, worker, test_with_PTY=test_with_PTY, **kwargs)


# This can go once Wasm32WasiPreview1DebugBuild is removed post-3.15.
class _Wasm32WasiPreview1Build(UnixBuild):
"""Build Python for wasm32-wasi using Tools/wasm/wasi.py."""
buildersuffix = ".wasi"
buildersuffix = ".wasip1"
factory_tags = ["wasm", "wasi"]
# pydebug and append_suffix defined in subclasses.

Expand All @@ -987,8 +988,12 @@ def __init__(self, source, *, extra_tags=[], **kwargs):
extra_tags.append("nondebug")
self.buildersuffix += self.append_suffix
if self.pydebug:
# The debug buildbot is meant for 3.13+, where WASM is tier 2
self.branches = BRANCHES.only_since(3, 13)
# The debug buildbot is meant for 3.13+, where WASM is tier 2.
# This builder is only needed up to 3.15 as that's the last version
# using wasm32-wasip1.
floor = BRANCHES.only_since(3, 13)
ceiling = BRANCHES.only_until(3, 15)
self.branches = BranchSet([*floor, *ceiling])
else:
# The non-debug WASI buildbot is meant for 3.11 and 3.12 only.
# Don't use it on PRs; it's tier 3 only and getting it to
Expand Down Expand Up @@ -1076,14 +1081,117 @@ def setup(self, branch, worker, test_with_PTY=False, **kwargs):
)


# Preventing this from running on versions older than 3.13 is managed in
# workers.py.
# Only needed for Python 3.13 - Python 3.15.
class Wasm32WasiPreview1DebugBuild(_Wasm32WasiPreview1Build):
append_suffix = ".debug"
pydebug = True
testFlags = ["-u-cpu"]


class Wasm32WasiPlatformDebugBuild(UnixBuild):
factory_tags = ["wasm", "wasi"]
buildersuffix = ".wasi"
pydebug = True
append_suffix = ".debug"

testFlags = ["-u-cpu"]

def __init__(self, source, *, extra_tags=[], **kwargs):
if self.pydebug:
self.buildersuffix += self.append_suffix
# `Platforms/WASI` was introduced in Python 3.15.
# `Platforms/WASI path` was introduced in Python 3.16.
self.branches = BRANCHES.only_since(3, 16)
super().__init__(source, extra_tags=extra_tags, **kwargs)

def setup(self, branch, worker, test_with_PTY=False, **kwargs):
wasi_py = "Platforms/WASI"
self.addStep(
SetPropertyFromCommand(
name="Determine WASI host path",
command=["python3", wasi_py, "path"],
property="wasi_host_path",
haltOnFailure=True,
)
)

# Build Python
build_configure = ["python3", wasi_py, "configure-build-python"]
if self.pydebug:
build_configure.extend(["--", "--with-pydebug"])
self.addStep(
Configure(
name="Configure build Python",
command=build_configure,
)
)
self.addStep(
Compile(
name="Compile build Python",
command=["python3", wasi_py, "make-build-python"],
)
)
self.addStep(
PythonInfo(
name="Display build info of the build Python",
command=["python3", wasi_py, "pythoninfo-build"],
)
)

# Host/WASI Python
self.addStep(
# Pydebug build automatically inferred from build Python.
Configure(
name="Configure host Python",
command=["python3", wasi_py, "configure-host"],
)
)
self.addStep(
Compile(
name="Compile host Python",
command=["python3", wasi_py, "make-host"],
)
)

self.addStep(
PythonInfo(
name="Display build info of the host/WASI Python",
command=["python3", wasi_py, "pythoninfo-host"],
)
)

# Copied from UnixBuild.
testopts = self.create_test_opts(branch, worker)
test = [
"make",
"buildbottest",
"TESTOPTS=" + " ".join(testopts) + " ${BUILDBOT_TESTOPTS}",
f"TESTPYTHONOPTS={self.interpreterFlags}",
f"TESTTIMEOUT={self.test_timeout}",
]
self.addStep(
Test(
command=test,
timeout=step_timeout(self.test_timeout),
usePTY=test_with_PTY,
env=self.test_environ,
workdir=util.Property("wasi_host_path"),
)
)
if not branch.is_pr and not has_option("-R", self.testFlags):
filename = util.Interpolate(
f"%(prop:wasi_host_path)s/{JUNIT_FILENAME}"
)
self.addStep(UploadTestResults(branch, filename=filename))

self.addStep(
Clean(
name="Clean the builds",
command=["python3", wasi_py, "clean"],
)
)


##############################################################################
################################ IOS BUILDS ################################
##############################################################################
Expand Down
Loading