@@ -41,7 +41,7 @@ def _to_generic_pyver(pyver_tags):
4141 return ['py%s' % tag [2 ] if tag .startswith ('cp' ) else tag for tag in pyver_tags ]
4242
4343
44- def _convert_to_generic_platform_wheel (wheel_ctx ):
44+ def _convert_to_generic_platform_wheel (wheel_ctx , additional_platforms ):
4545 """Switch to generic python tags and remove ABI tags from a wheel
4646
4747 Convert implementation specific python tags to their generic equivalent and
@@ -51,6 +51,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
5151 ----------
5252 wheel_ctx : InWheelCtx
5353 An open wheel context
54+ additional_platforms : Optional[Iterable[str]]
55+ An optional iterable of additional platform to add to the wheel
5456 """
5557
5658 abi_tags = ['none' ]
@@ -69,7 +71,14 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
6971
7072 # Update wheel filename
7173 fparts = wf .parsed_filename .groupdict ()
72- original_platform_tags = fparts ['plat' ].split ('.' )
74+ platform_tags = fparts ['plat' ].split ('.' )
75+ logger .debug ('Previous platform tags: %s' , ', ' .join (platform_tags ))
76+ if additional_platforms :
77+ platform_tags = list (sorted (set (platform_tags + [p for p in additional_platforms ])))
78+ fparts ['plat' ] = '.' .join (platform_tags )
79+ logger .debug ('New platform tags ....: %s' , ', ' .join (platform_tags ))
80+ else :
81+ logger .debug ('No platform tags change needed.' )
7382
7483 original_abi_tags = fparts ['abi' ].split ('.' )
7584 logger .debug ('Previous ABI tags: %s' , ', ' .join (original_abi_tags ))
@@ -114,7 +123,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
114123 pyc_apis = unique_by_index (pyc_apis )
115124
116125 # Set tags for each Python version, C-API combination
117- updated_tags = ['-' .join (tup ) for tup in product (pyc_apis , original_platform_tags )]
126+ updated_tags = ['-' .join (tup ) for tup in product (pyc_apis , platform_tags )]
118127
119128 if updated_tags != in_info_tags :
120129 del info ['Tag' ]
@@ -128,7 +137,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
128137 return out_wheel
129138
130139
131- def convert_to_generic_platform_wheel (wheel_path , out_dir = './dist/' , remove_original = False , verbose = 0 ):
140+ def convert_to_generic_platform_wheel (wheel_path , out_dir = './dist/' , remove_original = False , verbose = 0 ,
141+ additional_platforms = None ):
132142 logging .disable (logging .NOTSET )
133143 if verbose >= 1 :
134144 logging .basicConfig (level = logging .DEBUG )
@@ -140,7 +150,7 @@ def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_orig
140150
141151 with InWheelCtx (wheel_path ) as ctx :
142152 ctx .out_wheel = pjoin (out_dir , wheel_fname )
143- ctx .out_wheel = _convert_to_generic_platform_wheel (ctx )
153+ ctx .out_wheel = _convert_to_generic_platform_wheel (ctx , additional_platforms )
144154
145155 if remove_original :
146156 logger .info ('Removed original wheel %s' % wheel_path )
0 commit comments