Skip to content

Commit

Permalink
Fix wheel filenames for compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
virtuald committed Oct 30, 2023
1 parent 0dcfcd4 commit c50d970
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions devtools/subproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def install_build_deps(self, *, wheel_path: pathlib.Path):
"--disable-pip-version-check",
"--find-links",
str(wheel_path),
*[str(req) for req in self.requires]
*[str(req) for req in self.requires],
)

def develop(self):
Expand Down Expand Up @@ -95,7 +95,7 @@ def bdist_wheel(self, *, wheel_path: pathlib.Path, install: bool):

tdp = pathlib.Path(td)
twhl = list(tdp.glob("*.whl"))[0]
dst_whl = wheel_path / twhl.name
dst_whl = wheel_path / self._fix_wheel_name(twhl.name)
shutil.move(twhl, dst_whl)

# Setuptools is dumb
Expand All @@ -115,3 +115,18 @@ def bdist_wheel(self, *, wheel_path: pathlib.Path, install: bool):
str(wheel_path),
str(dst_whl),
)

_adjust_wheel_tags = {
# pypi only accepts manylinux wheels, and we know we're compatible
"linux_x86_64": "manylinux_2_35_x86_64",
# needed for compatibility with python compiled with older xcode
"macosx_11_0_x86_64": "macosx_10_16_x86_64",
}

def _fix_wheel_name(self, name: str) -> str:
for old, new in self._adjust_wheel_tags.items():
old_whl = f"{old}.whl"
new_whl = f"{new}.whl"
if name.endswith(old_whl):
name = f"{name[:-len(old_whl)]}{new_whl}"
return name

0 comments on commit c50d970

Please sign in to comment.