Skip to content

Commit

Permalink
Merge pull request #1629 from henryiii/henryiii/refactor/schemaref
Browse files Browse the repository at this point in the history
refactor: use refs instead of copies
  • Loading branch information
joerick authored Oct 3, 2023
2 parents 70fae8d + 5fee292 commit 9535d16
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 859 deletions.
28 changes: 12 additions & 16 deletions bin/generate_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,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 @@ -240,25 +243,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

0 comments on commit 9535d16

Please sign in to comment.