Skip to content

chore: use wheel tags cli #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions requirements-repair.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
git+https://github.com/jcfr/wheeltools.git@wheeltools-2018-10-28-a2f174d0e
wheel<0.38
wheel>=0.40.0
208 changes: 0 additions & 208 deletions scripts/convert_to_generic_platform_wheel.py

This file was deleted.

23 changes: 13 additions & 10 deletions scripts/repair_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import zipfile
from pathlib import Path

from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel


def main():
if sys.platform.startswith("linux"):
Expand Down Expand Up @@ -56,8 +54,8 @@ def main():
assert len(files) == 1, files
file = files[0]

# we need to handle macOS x86_64 & arm64 here for now, let's use additional_platforms for this.
additional_platforms = []
# we need to handle macOS x86_64 & arm64 here for now, let's use platform_tag_args for this.
platform_tag_args = []
if os_ == "macos":
# delocate-wheel --require-archs does not seem to check executables...
with tempfile.TemporaryDirectory() as tmpdir2_:
Expand All @@ -67,7 +65,7 @@ def main():
exe = list(tmpdir2.glob("**/bin/ninja"))
assert len(exe) == 1, exe
subprocess.run(["lipo", str(exe[0]), "-verify_arch", "x86_64", "arm64"], check=True, stdout=subprocess.PIPE)

additional_platforms = []
# first, get the target macOS deployment target from the wheel
match = re.match(r"^.*-macosx_(\d+)_(\d+)_.*\.whl$", file.name)
assert match is not None, f"Couldn't match on {file.name}"
Expand All @@ -88,13 +86,18 @@ def main():
# They're were also issues with pip not picking up some universal2 wheels, tag twice
additional_platforms.append("macosx_11_0_universal2")

platform_tag_args = [f"--platform-tag=+{'.'.join(additional_platforms)}"]

# make this a py2.py3 wheel
convert_to_generic_platform_wheel(
str(file),
out_dir=str(wheelhouse),
py2_py3=True,
additional_platforms=additional_platforms,
subprocess.run(
["wheel", "tags", "--python-tag", "py2.py3", "--abi-tag", "none", *platform_tag_args, "--remove", str(file)],
check=True,
stdout=subprocess.PIPE,
)
files = list(tmpdir.glob("*.whl"))
assert len(files) == 1, files
file = files[0]
file.rename(wheelhouse / file.name)


if __name__ == "__main__":
Expand Down