99import tempfile
1010from pathlib import Path
1111
12- from convert_to_generic_platform_wheel import convert_to_generic_platform_wheel
13-
1412
1513def main ():
1614 if sys .platform .startswith ("linux" ):
@@ -55,9 +53,11 @@ def main():
5553 shutil .copyfile (file , tmpdir / file .name )
5654 (file ,) = tmpdir .glob ("*.whl" )
5755
58- # we need to handle macOS universal2 & arm64 here for now, let's use additional_platforms for this.
59- additional_platforms = []
56+ # we need to handle macOS universal2 & arm64 here for now, let's use platform_tag_args for this.
57+ platform_tag_args = []
6058 if os_ == "macos" :
59+ additional_platforms = []
60+
6161 # first, get the target macOS deployment target from the wheel
6262 match = re .match (r"^.*-macosx_(\d+)_(\d+)_x86_64\.whl$" , file .name )
6363 assert match is not None
@@ -77,13 +77,18 @@ def main():
7777 # They're were also issues with pip not picking up some universal2 wheels, tag twice
7878 additional_platforms .append ("macosx_11_0_universal2" )
7979
80+ platform_tag_args = [f"--platform-tag=+{ '.' .join (additional_platforms )} " ]
81+
8082 # make this a py2.py3 wheel
81- convert_to_generic_platform_wheel (
82- str (file ),
83- out_dir = str (wheelhouse ),
84- py2_py3 = True ,
85- additional_platforms = additional_platforms ,
83+ subprocess .run (
84+ ["wheel" , "tags" , "--python-tag" , "py2.py3" , "--abi-tag" , "none" , * platform_tag_args , "--remove" , str (file )],
85+ check = True ,
86+ stdout = subprocess .PIPE ,
8687 )
88+ files = list (tmpdir .glob ("*.whl" ))
89+ assert len (files ) == 1 , files
90+ file = files [0 ]
91+ file .rename (wheelhouse / file .name )
8792
8893
8994if __name__ == "__main__" :
0 commit comments