* Update python versions as part of update_dependencies * refactor: pulling out to update_pythons * refactor: rewrite and expect install * feat: support macos too, logging output * WIP: update * refactor: drive from original file * Remove unused variable * Output a diff instead of the result file, to review changes more easily * fix: minor cleanup Co-authored-by: Henry Fredrick Schreiner <henry.fredrick.schreiner@cern.ch> Co-authored-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Joe Rickerby <joerick@mac.com>
25 lines
781 B
Python
25 lines
781 B
Python
"""
|
|
These are utilities for the `/bin` scripts, not for the `cibuildwheel` program.
|
|
"""
|
|
|
|
from typing import Any, Dict
|
|
|
|
import toml.encoder
|
|
from packaging.version import Version
|
|
|
|
|
|
class InlineArrayDictEncoder(toml.encoder.TomlEncoder): # type: ignore
|
|
def __init__(self) -> None:
|
|
super().__init__()
|
|
self.dump_funcs[Version] = lambda v: f'"{v}"'
|
|
|
|
def dump_sections(self, o: Dict[str, Any], sup: str) -> Any:
|
|
if all(isinstance(a, list) for a in o.values()):
|
|
val = ""
|
|
for k, v in o.items():
|
|
inner = ",\n ".join(self.dump_inline_table(d_i).strip() for d_i in v)
|
|
val += f"{k} = [\n {inner},\n]\n"
|
|
return val, self._dict()
|
|
else:
|
|
return super().dump_sections(o, sup)
|