* feat: add Pyodide support Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Hood Chatham <roberthoodchatham@gmail.com> Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com> tests: fix two merge issues Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> fix: include schema Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Try to fix xbuildenv path [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci Try to install pyodide-build from main branch Try again Try again Update constraints file Try again Remove unused variable Drop constraints Remove --download option Fix xbuildenv install Try again Try again [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix: remove pinning on pyodide Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Update for Pyodide 0.26.0a5 * Install pyodide-build from pypi * Update docs/options.md Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com> * Unxfail things that look like they were just a version mismatch * refactor: add constraints for pyodide Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * chore: minor cleanup Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Apply suggestions from code review * Apply suggestion from code review * refactor: minor touchup Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * ci: xfail the pyodide test Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * review: use a pinned version of node * fix tests * review: error out on Windows * test: check node & test on macos arm64 * chore: minor cleanup * Add reference to emscripten libc issue * Apply suggestion from code review * review: use a pinned pip in test virtual environment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * chore: rework test virtual environment seed packages * chore: workaround direct invocation of pytest This allows to still test direct invocation of `pytest` on most platforms (including pyodide on Linux) but falls back to `python -m pytest` when running pyodide on macOS. * Use release version of pyodide * fix: tests for 0.26.0 & parallel initialization of xbuildenv * Debug CI * fix: test/test_build_frontend_args.py * Revert "Debug CI" This reverts commit 917646cffc96dbfc619c47d1c03a828f447bcdb7. --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
308 lines
8.8 KiB
Python
Executable File
308 lines
8.8 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
# /// script
|
|
# dependencies = ["pyyaml"]
|
|
# ///
|
|
|
|
import argparse
|
|
import copy
|
|
import json
|
|
from typing import Any
|
|
|
|
import yaml
|
|
|
|
parser = argparse.ArgumentParser()
|
|
parser.add_argument("--schemastore", action="store_true", help="Generate schema_store version")
|
|
args = parser.parse_args()
|
|
|
|
starter = """
|
|
$schema: http://json-schema.org/draft-07/schema
|
|
$id: https://github.com/pypa/cibuildwheel/blob/main/cibuildwheel/resources/cibuildwheel.schema.json
|
|
$defs:
|
|
inherit:
|
|
enum:
|
|
- none
|
|
- prepend
|
|
- append
|
|
default: none
|
|
description: How to inherit the parent's value.
|
|
additionalProperties: false
|
|
description: cibuildwheel's settings.
|
|
type: object
|
|
properties:
|
|
archs:
|
|
description: Change the architectures built on your machine by default.
|
|
type: string_array
|
|
before-all:
|
|
description: Execute a shell command on the build system before any wheels are built.
|
|
type: string_array
|
|
before-build:
|
|
description: Execute a shell command preparing each wheel's build.
|
|
type: string_array
|
|
before-test:
|
|
description: Execute a shell command before testing each wheel.
|
|
type: string_array
|
|
build:
|
|
default: ['*']
|
|
description: Choose the Python versions to build.
|
|
type: string_array
|
|
build-frontend:
|
|
default: default
|
|
description: Set the tool to use to build, either "pip" (default for now) or "build"
|
|
oneOf:
|
|
- enum: [pip, build, default]
|
|
- type: string
|
|
pattern: '^pip; ?args:'
|
|
- type: string
|
|
pattern: '^build; ?args:'
|
|
- type: object
|
|
additionalProperties: false
|
|
required: [name]
|
|
properties:
|
|
name:
|
|
enum: [pip, build]
|
|
args:
|
|
type: array
|
|
items:
|
|
type: string
|
|
build-verbosity:
|
|
type: integer
|
|
minimum: -3
|
|
maximum: 3
|
|
default: 0
|
|
description: Increase/decrease the output of pip wheel.
|
|
config-settings:
|
|
description: Specify config-settings for the build backend.
|
|
type: string_table_array
|
|
container-engine:
|
|
oneOf:
|
|
- enum: [docker, podman]
|
|
- type: string
|
|
pattern: '^docker; ?(create_args|disable_host_mount):'
|
|
- type: string
|
|
pattern: '^podman; ?(create_args|disable_host_mount):'
|
|
- type: object
|
|
additionalProperties: false
|
|
required: [name]
|
|
properties:
|
|
name:
|
|
enum: [docker, podman]
|
|
create-args:
|
|
type: array
|
|
items:
|
|
type: string
|
|
disable-host-mount:
|
|
type: boolean
|
|
dependency-versions:
|
|
default: pinned
|
|
description: Specify how cibuildwheel controls the versions of the tools it uses
|
|
type: string
|
|
environment:
|
|
description: Set environment variables needed during the build.
|
|
type: string_table
|
|
environment-pass:
|
|
description: Set environment variables on the host to pass-through to the container
|
|
during the build.
|
|
type: string_array
|
|
free-threaded-support:
|
|
type: boolean
|
|
default: false
|
|
description: The project supports free-threaded builds of Python (PEP703)
|
|
manylinux-aarch64-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-i686-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-ppc64le-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-pypy_aarch64-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-pypy_i686-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-pypy_x86_64-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-s390x-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
manylinux-x86_64-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
musllinux-aarch64-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
musllinux-i686-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
musllinux-ppc64le-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
musllinux-s390x-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
musllinux-x86_64-image:
|
|
type: string
|
|
description: Specify alternative manylinux / musllinux container images
|
|
repair-wheel-command:
|
|
type: string_array
|
|
description: Execute a shell command to repair each built wheel.
|
|
skip:
|
|
description: Choose the Python versions to skip.
|
|
type: string_array
|
|
test-command:
|
|
description: Execute a shell command to test each built wheel.
|
|
type: string_array
|
|
test-extras:
|
|
description: Install your wheel for testing using `extras_require`
|
|
type: string_array
|
|
test-requires:
|
|
description: Install Python dependencies before running the tests
|
|
type: string_array
|
|
test-skip:
|
|
description: Skip running tests on some builds.
|
|
type: string_array
|
|
"""
|
|
|
|
schema = yaml.safe_load(starter)
|
|
|
|
string_array = yaml.safe_load(
|
|
"""
|
|
- type: string
|
|
- type: array
|
|
items:
|
|
type: string
|
|
"""
|
|
)
|
|
|
|
string_table_array = yaml.safe_load(
|
|
"""
|
|
- type: string
|
|
- type: object
|
|
additionalProperties: false
|
|
patternProperties:
|
|
.+:
|
|
oneOf:
|
|
- type: string
|
|
- type: array
|
|
items:
|
|
type: string
|
|
"""
|
|
)
|
|
|
|
string_table = yaml.safe_load(
|
|
"""
|
|
- type: string
|
|
- type: object
|
|
additionalProperties: false
|
|
patternProperties:
|
|
.+:
|
|
type: string
|
|
"""
|
|
)
|
|
|
|
for value in schema["properties"].values():
|
|
match value:
|
|
case {"type": "string_array"}:
|
|
del value["type"]
|
|
value["oneOf"] = string_array
|
|
case {"type": "string_table"}:
|
|
del value["type"]
|
|
value["oneOf"] = string_table
|
|
case {"type": "string_table_array"}:
|
|
del value["type"]
|
|
value["oneOf"] = string_table_array
|
|
|
|
overrides = yaml.safe_load(
|
|
"""
|
|
type: array
|
|
description: An overrides array
|
|
items:
|
|
type: object
|
|
required: ["select"]
|
|
minProperties: 2
|
|
additionalProperties: false
|
|
properties:
|
|
select: {}
|
|
inherit:
|
|
type: object
|
|
additionalProperties: false
|
|
properties:
|
|
before-all: {"$ref": "#/$defs/inherit"}
|
|
before-build: {"$ref": "#/$defs/inherit"}
|
|
before-test: {"$ref": "#/$defs/inherit"}
|
|
config-settings: {"$ref": "#/$defs/inherit"}
|
|
container-engine: {"$ref": "#/$defs/inherit"}
|
|
environment: {"$ref": "#/$defs/inherit"}
|
|
environment-pass: {"$ref": "#/$defs/inherit"}
|
|
repair-wheel-command: {"$ref": "#/$defs/inherit"}
|
|
test-command: {"$ref": "#/$defs/inherit"}
|
|
test-extras: {"$ref": "#/$defs/inherit"}
|
|
test-requires: {"$ref": "#/$defs/inherit"}
|
|
"""
|
|
)
|
|
|
|
for key, value in schema["properties"].items():
|
|
value["title"] = f'CIBW_{key.replace("-", "_").upper()}'
|
|
|
|
non_global_options = {k: {"$ref": f"#/properties/{k}"} for k in schema["properties"]}
|
|
del non_global_options["build"]
|
|
del non_global_options["skip"]
|
|
del non_global_options["test-skip"]
|
|
del non_global_options["free-threaded-support"]
|
|
|
|
overrides["items"]["properties"]["select"]["oneOf"] = string_array
|
|
overrides["items"]["properties"] |= non_global_options.copy()
|
|
|
|
del overrides["items"]["properties"]["archs"]
|
|
|
|
not_linux = non_global_options.copy()
|
|
|
|
del not_linux["environment-pass"]
|
|
del not_linux["container-engine"]
|
|
for key in list(not_linux):
|
|
if "linux-" in key:
|
|
del not_linux[key]
|
|
|
|
|
|
def as_object(d: dict[str, Any]) -> dict[str, Any]:
|
|
return {
|
|
"type": "object",
|
|
"additionalProperties": False,
|
|
"properties": copy.deepcopy(d),
|
|
}
|
|
|
|
|
|
oses = {
|
|
"linux": as_object(non_global_options),
|
|
"windows": as_object(not_linux),
|
|
"macos": as_object(not_linux),
|
|
"pyodide": as_object(not_linux),
|
|
}
|
|
|
|
oses["linux"]["properties"]["repair-wheel-command"] = {
|
|
**schema["properties"]["repair-wheel-command"],
|
|
"default": "auditwheel repair -w {dest_dir} {wheel}",
|
|
}
|
|
oses["macos"]["properties"]["repair-wheel-command"] = {
|
|
**schema["properties"]["repair-wheel-command"],
|
|
"default": "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}",
|
|
}
|
|
|
|
del oses["linux"]["properties"]["dependency-versions"]
|
|
|
|
schema["properties"]["overrides"] = overrides
|
|
schema["properties"] |= oses
|
|
|
|
if args.schemastore:
|
|
schema["$id"] = "https://json.schemastore.org/partial-cibuildwheel.json"
|
|
schema["$schema"] = "http://json-schema.org/draft-07/schema#"
|
|
schema["description"] = (
|
|
"cibuildwheel's toml file, generated with ./bin/generate_schema.py --schemastore from cibuildwheel."
|
|
)
|
|
|
|
print(json.dumps(schema, indent=2))
|