Skip to content
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

refactor: use refs instead of copies #1629

Merged
merged 1 commit into from
Oct 3, 2023
Merged
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
28 changes: 12 additions & 16 deletions bin/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,10 @@
"""
)

non_global_options = copy.deepcopy(schema["properties"])
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["container-engine"]
Expand Down Expand Up @@ -239,25 +242,18 @@ def as_object(d: dict[str, Any]) -> dict[str, Any]:
"macos": as_object(not_linux),
}

oses["linux"]["properties"]["repair-wheel-command"][
"default"
] = "auditwheel repair -w {dest_dir} {wheel}"
oses["macos"]["properties"]["repair-wheel-command"][
"default"
] = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel}"
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

for key, value in schema["properties"].items():
value["title"] = f'CIBW_{key.replace("-", "_").upper()}'
for key, value in schema["properties"]["linux"]["properties"].items():
value["title"] = f'CIBW_{key.replace("-", "_").upper()}_LINUX'
for key, value in schema["properties"]["macos"]["properties"].items():
value["title"] = f'CIBW_{key.replace("-", "_").upper()}_MACOS'
for key, value in schema["properties"]["windows"]["properties"].items():
value["title"] = f'CIBW_{key.replace("-", "_").upper()}_WINDOWS'

print(json.dumps(schema, indent=2))
Loading