fix: updates should include universal2 Pythons (#573)
* fix: updates should include universal2 Pythons * refactor: rename to macos_cpython
This commit is contained in:
@@ -21,7 +21,6 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
files: ^bin/update_pythons.py$
|
files: ^bin/update_pythons.py$
|
||||||
args: ["--line-length=120"]
|
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||||
rev: v0.800
|
rev: v0.800
|
||||||
@@ -29,6 +28,7 @@ repos:
|
|||||||
- id: mypy
|
- id: mypy
|
||||||
exclude: ^(bin/|cibuildwheel/resources/).*py$
|
exclude: ^(bin/|cibuildwheel/resources/).*py$
|
||||||
additional_dependencies: [packaging]
|
additional_dependencies: [packaging]
|
||||||
|
args: ["--python-version=3.6", "--ignore-missing-imports", "--scripts-are-modules"]
|
||||||
- id: mypy
|
- id: mypy
|
||||||
name: mypy 3.7+ on bin/
|
name: mypy 3.7+ on bin/
|
||||||
files: ^bin/.*py$
|
files: ^bin/.*py$
|
||||||
|
|||||||
+10
-13
@@ -164,7 +164,7 @@ class PyPyVersions:
|
|||||||
|
|
||||||
|
|
||||||
class CPythonVersions:
|
class CPythonVersions:
|
||||||
def __init__(self, plat_arch: str, file_ident: str) -> None:
|
def __init__(self) -> None:
|
||||||
|
|
||||||
response = requests.get("https://www.python.org/api/v2/downloads/release/?is_published=true")
|
response = requests.get("https://www.python.org/api/v2/downloads/release/?is_published=true")
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
@@ -180,11 +180,8 @@ class CPythonVersions:
|
|||||||
uri = int(release["resource_uri"].rstrip("/").split("/")[-1])
|
uri = int(release["resource_uri"].rstrip("/").split("/")[-1])
|
||||||
self.versions_dict[version] = uri
|
self.versions_dict[version] = uri
|
||||||
|
|
||||||
self.file_ident = file_ident
|
def update_version_macos(self, identifier: str, spec: Specifier) -> Optional[ConfigMacOS]:
|
||||||
self.plat_arch = plat_arch
|
file_idents = ("macos11.0.pkg", "macosx10.9.pkg", "macosx10.6.pkg")
|
||||||
|
|
||||||
def update_version_macos(self, spec: Specifier) -> Optional[ConfigMacOS]:
|
|
||||||
|
|
||||||
sorted_versions = sorted(v for v in self.versions_dict if spec.contains(v))
|
sorted_versions = sorted(v for v in self.versions_dict if spec.contains(v))
|
||||||
|
|
||||||
for version in reversed(sorted_versions):
|
for version in reversed(sorted_versions):
|
||||||
@@ -194,10 +191,11 @@ class CPythonVersions:
|
|||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
file_info = response.json()
|
file_info = response.json()
|
||||||
|
|
||||||
urls = [rf["url"] for rf in file_info if self.file_ident in rf["url"]]
|
for file_ident in file_idents:
|
||||||
|
urls = [rf["url"] for rf in file_info if file_ident in rf["url"]]
|
||||||
if urls:
|
if urls:
|
||||||
return ConfigMacOS(
|
return ConfigMacOS(
|
||||||
identifier=f"cp{version.major}{version.minor}-{self.plat_arch}",
|
identifier=identifier,
|
||||||
version=f"{version.major}.{version.minor}",
|
version=f"{version.major}.{version.minor}",
|
||||||
url=urls[0],
|
url=urls[0],
|
||||||
)
|
)
|
||||||
@@ -215,9 +213,7 @@ class AllVersions:
|
|||||||
self.windows_64 = WindowsVersions("64")
|
self.windows_64 = WindowsVersions("64")
|
||||||
self.windows_pypy = PyPyVersions("32")
|
self.windows_pypy = PyPyVersions("32")
|
||||||
|
|
||||||
self.macos_6 = CPythonVersions(plat_arch="macosx_x86_64", file_ident="macosx10.6.pkg")
|
self.macos_cpython = CPythonVersions()
|
||||||
self.macos_9 = CPythonVersions(plat_arch="macosx_x86_64", file_ident="macosx10.9.pkg")
|
|
||||||
self.macos_u2 = CPythonVersions(plat_arch="macosx_universal2", file_ident="macos11.0.pkg")
|
|
||||||
self.macos_pypy = PyPyVersions("64")
|
self.macos_pypy = PyPyVersions("64")
|
||||||
|
|
||||||
def update_config(self, config: Dict[str, str]) -> None:
|
def update_config(self, config: Dict[str, str]) -> None:
|
||||||
@@ -229,11 +225,12 @@ class AllVersions:
|
|||||||
config_update: Optional[AnyConfig]
|
config_update: Optional[AnyConfig]
|
||||||
|
|
||||||
# We need to use ** in update due to MyPy (probably a bug)
|
# We need to use ** in update due to MyPy (probably a bug)
|
||||||
if "macosx_x86_64" in identifier:
|
if "macos" in identifier:
|
||||||
if identifier.startswith("pp"):
|
if identifier.startswith("pp"):
|
||||||
config_update = self.macos_pypy.update_version_macos(spec)
|
config_update = self.macos_pypy.update_version_macos(spec)
|
||||||
else:
|
else:
|
||||||
config_update = self.macos_9.update_version_macos(spec) or self.macos_6.update_version_macos(spec)
|
config_update = self.macos_cpython.update_version_macos(identifier, spec)
|
||||||
|
|
||||||
assert config_update is not None, f"MacOS {spec} not found!"
|
assert config_update is not None, f"MacOS {spec} not found!"
|
||||||
config.update(**config_update)
|
config.update(**config_update)
|
||||||
elif "win32" in identifier:
|
elif "win32" in identifier:
|
||||||
|
|||||||
@@ -5,3 +5,7 @@ requires = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
build-backend = "setuptools.build_meta"
|
build-backend = "setuptools.build_meta"
|
||||||
|
|
||||||
|
[tool.black]
|
||||||
|
line-length = 120
|
||||||
|
target-version = ['py36']
|
||||||
|
|||||||
@@ -83,8 +83,8 @@ exclude =
|
|||||||
junit_family=xunit2
|
junit_family=xunit2
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
python_version = 3.6
|
python_version = 3.7
|
||||||
files = cibuildwheel/*.py,test/**/*.py,unit_test/**/*.py
|
files = cibuildwheel/*.py,test/**/*.py,unit_test/**/*.py,bin/*.py
|
||||||
warn_unused_configs = True
|
warn_unused_configs = True
|
||||||
warn_redundant_casts = True
|
warn_redundant_casts = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user