@@ -41,7 +41,7 @@ def _to_generic_pyver(pyver_tags):
41
41
return ['py%s' % tag [2 ] if tag .startswith ('cp' ) else tag for tag in pyver_tags ]
42
42
43
43
44
- def _convert_to_generic_platform_wheel (wheel_ctx ):
44
+ def _convert_to_generic_platform_wheel (wheel_ctx , additional_platforms ):
45
45
"""Switch to generic python tags and remove ABI tags from a wheel
46
46
47
47
Convert implementation specific python tags to their generic equivalent and
@@ -51,6 +51,8 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
51
51
----------
52
52
wheel_ctx : InWheelCtx
53
53
An open wheel context
54
+ additional_platforms : Optional[Iterable[str]]
55
+ An optional iterable of additional platform to add to the wheel
54
56
"""
55
57
56
58
abi_tags = ['none' ]
@@ -69,7 +71,14 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
69
71
70
72
# Update wheel filename
71
73
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.' )
73
82
74
83
original_abi_tags = fparts ['abi' ].split ('.' )
75
84
logger .debug ('Previous ABI tags: %s' , ', ' .join (original_abi_tags ))
@@ -114,7 +123,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
114
123
pyc_apis = unique_by_index (pyc_apis )
115
124
116
125
# 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 )]
118
127
119
128
if updated_tags != in_info_tags :
120
129
del info ['Tag' ]
@@ -128,7 +137,7 @@ def _convert_to_generic_platform_wheel(wheel_ctx):
128
137
return out_wheel
129
138
130
139
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 , additional_platforms = None ):
132
141
logging .disable (logging .NOTSET )
133
142
if verbose >= 1 :
134
143
logging .basicConfig (level = logging .DEBUG )
@@ -140,7 +149,7 @@ def convert_to_generic_platform_wheel(wheel_path, out_dir='./dist/', remove_orig
140
149
141
150
with InWheelCtx (wheel_path ) as ctx :
142
151
ctx .out_wheel = pjoin (out_dir , wheel_fname )
143
- ctx .out_wheel = _convert_to_generic_platform_wheel (ctx )
152
+ ctx .out_wheel = _convert_to_generic_platform_wheel (ctx , additional_platforms )
144
153
145
154
if remove_original :
146
155
logger .info ('Removed original wheel %s' % wheel_path )
@@ -175,7 +184,7 @@ def main():
175
184
if not isfile (args .WHEEL_FILE ):
176
185
p .error ('cannot access %s. No such file' % args .WHEEL_FILE )
177
186
178
- convert_to_generic_platform_wheel (args .WHEEL_FILE , args .WHEEL_DIR , args .remove_original , args .verbose )
187
+ convert_to_generic_platform_wheel (args .WHEEL_FILE , args .WHEEL_DIR , args .remove_original , args .verbose , additional_platforms )
179
188
180
189
181
190
if __name__ == '__main__' :
0 commit comments