8
8
import zipfile
9
9
from pathlib import Path
10
10
11
- from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel
12
-
13
11
14
12
def main ():
15
13
if sys .platform .startswith ("linux" ):
@@ -56,8 +54,8 @@ def main():
56
54
assert len (files ) == 1 , files
57
55
file = files [0 ]
58
56
59
- # we need to handle macOS x86_64 & arm64 here for now, let's use additional_platforms for this.
60
- additional_platforms = []
57
+ # we need to handle macOS x86_64 & arm64 here for now, let's use platform_tag_args for this.
58
+ platform_tag_args = []
61
59
if os_ == "macos" :
62
60
# delocate-wheel --require-archs does not seem to check executables...
63
61
with tempfile .TemporaryDirectory () as tmpdir2_ :
@@ -67,7 +65,7 @@ def main():
67
65
exe = list (tmpdir2 .glob ("**/bin/ninja" ))
68
66
assert len (exe ) == 1 , exe
69
67
subprocess .run (["lipo" , str (exe [0 ]), "-verify_arch" , "x86_64" , "arm64" ], check = True , stdout = subprocess .PIPE )
70
-
68
+ additional_platforms = []
71
69
# first, get the target macOS deployment target from the wheel
72
70
match = re .match (r"^.*-macosx_(\d+)_(\d+)_.*\.whl$" , file .name )
73
71
assert match is not None , f"Couldn't match on { file .name } "
@@ -88,13 +86,18 @@ def main():
88
86
# They're were also issues with pip not picking up some universal2 wheels, tag twice
89
87
additional_platforms .append ("macosx_11_0_universal2" )
90
88
89
+ platform_tag_args = ["--platform-tag" , f".{ '.' .join (additional_platforms )} " ]
90
+
91
91
# make this a py2.py3 wheel
92
- convert_to_generic_platform_wheel (
93
- str (file ),
94
- out_dir = str (wheelhouse ),
95
- py2_py3 = True ,
96
- additional_platforms = additional_platforms ,
92
+ subprocess .run (
93
+ ["wheel" , "tags" , "--python-tag" , "py2.py3" , "--abi-tag" , "none" , * platform_tag_args , "--remove" , str (file )],
94
+ check = True ,
95
+ stdout = subprocess .PIPE ,
97
96
)
97
+ files = list (tmpdir .glob ("*.whl" ))
98
+ assert len (files ) == 1 , files
99
+ file = files [0 ]
100
+ file .rename (wheelhouse / file .name )
98
101
99
102
100
103
if __name__ == "__main__" :
0 commit comments