feat: update python versions as part of update_dependencies (#496)

* 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>
This commit is contained in:
Matthieu Darbois
2021-01-15 14:40:03 +00:00
committed by GitHub
co-authored by Henry Fredrick Schreiner Henry Schreiner Joe Rickerby
parent ca7871ce0c
commit d394386318
8 changed files with 384 additions and 20 deletions
+26 -11
View File
@@ -1,19 +1,11 @@
import pytest
import toml
from toml.encoder import TomlEncoder
from cibuildwheel.util import resources_dir
Version = pytest.importorskip("packaging.version").Version
class InlineArrayDictEncoder(TomlEncoder):
def dump_sections(self, o: dict, sup: str):
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)
from cibuildwheel.extra import InlineArrayDictEncoder # noqa: E402
def test_compare_configs():
@@ -26,3 +18,26 @@ def test_compare_configs():
print(new_txt)
assert new_txt == txt
def test_dump_with_Version():
example = {
"windows": {
"python_configurations": [
{"identifier": "cp27-win32", "version": Version("2.7.18"), "arch": "32"},
{"identifier": "cp27-win_amd64", "version": Version("2.7.18"), "arch": "64"},
]
}
}
result = """\
[windows]
python_configurations = [
{ identifier = "cp27-win32", version = "2.7.18", arch = "32" },
{ identifier = "cp27-win_amd64", version = "2.7.18", arch = "64" },
]
"""
output = toml.dumps(example, encoder=InlineArrayDictEncoder())
print(output)
assert output == result