@@ -51,19 +51,15 @@ def find_major_import_import_names(wheel: WheelSource) -> Iterable[str]:
5151 if not (metadata ["Wheel-Version" ] and metadata ["Wheel-Version" ].startswith ("1." )):
5252 raise NotImplementedError ("Only supports wheel 1.x" )
5353
54- filepaths : Iterable [str ] = (
55- record_elements [0 ] for record_elements , _ , _ in wheel .get_contents ()
56- )
54+ filepaths : Iterable [str ] = (record_elements [0 ] for record_elements , _ , _ in wheel .get_contents ())
5755 importable_components = _find_importable_components_from_wheel_content_listing (
5856 filepaths , dist_info_dir = wheel .dist_info_dir , data_dir = wheel .data_dir
5957 )
6058
6159 return _determine_major_import_names (importable_components )
6260
6361
64- def _determine_major_import_names (
65- importable_components : Iterable [tuple [str , ...]]
66- ) -> Iterable [str ]:
62+ def _determine_major_import_names (importable_components : Iterable [tuple [str , ...]]) -> Iterable [str ]:
6763 # If you literally want the "top level", just do...
6864 # return {components[0] for components in importable_components}
6965
@@ -95,7 +91,6 @@ def _determine_major_import_names(
9591 yield "." .join (subname )
9692
9793
98-
9994def process_wheel (whl , whlname ):
10095 found = False
10196
@@ -107,16 +102,15 @@ def process_wheel(whl, whlname):
107102 tln = tln .strip ().replace ("/" , "." )
108103 if not tln :
109104 continue
110- # https://matrix.to/#/!tzLDlLJSRpMoEoMBGG:gitter.im/$ARVOAirw4AiSn2wuzZs76QoKfKp7_PwFMlw2OhucS6g?via=gitter.im&via=matrix.org&via=ocf.berkeley.edu
111- # pyodide's kiwisolver has src in dist-info toplevel
105+ # pyodide's kiwisolver has src in dist-info toplevel
112106 if tln == "src" :
113107 continue
114- # =============================================================================
108+ # =============================================================================
115109 if tln == "cwcwidth" :
116110 MAP ["wcwidth" ] = whlname
117- # =============================================================================
111+ # =============================================================================
118112 if tln in MAP :
119- print (f"override pkg name toplevel { tln } with" , whlname )
113+ print (f"override pkg name toplevel { tln } with" , whlname )
120114 MAP [tln ] = whlname
121115 archive .close ()
122116 found = True
@@ -130,68 +124,82 @@ def process_wheel(whl, whlname):
130124
131125
132126
127+ import pygbag
128+
129+
130+
131+ print (
132+ f"""
133+
134+ ============== { pygbag .VERSION = } pure/abi3-bi ======================
135+
136+
137+ """
138+ )
139+
133140
134141# process pure wheels and abi3
135142
136- for whl in Path ("." ).glob ("pkg/*.whl" ):
137- whlname = whl .as_posix ()
138- abi3 = False
139- # keep only abi3
140- if str (whl ).find ('-wasm32' )> 0 :
141- if str (whl ).find ('-abi3-' )< 0 :
142- continue
143- else :
144- abi3 = True
143+ for repo in ["pkg/*.whl" ,f"{ pygbag .VERSION } /*.whl" ]:
144+ for whl in Path ("." ).glob (repo ):
145+ whlname = whl .as_posix ()
146+ abi3 = False
147+ # keep only abi3
148+ if str (whl ).find ("-wasm32" ) > 0 :
149+ if str (whl ).find ("-abi3-" ) < 0 :
150+ continue
151+ else :
152+ abi3 = True
145153
146- if not abi3 :
147- for replace in ("-cp310" , "-cp311" , "-cp312" , "-cp313" ):
148- whlname = whlname .replace (replace , "-<abi>" )
154+ if not abi3 :
155+ for replace in ("-cp310" , "-cp311" , "-cp312" , "-cp313" ):
156+ whlname = whlname .replace (replace , "-<abi>" )
157+
158+ process_wheel (whl , whlname )
149159
150- process_wheel (whl , whlname )
151160
152161
153162
154- print ("""
163+ print (
164+ f"""
155165
156166
157- ============== bi ======================
167+ ============== { pygbag . VERSION = } c-api bi ======================
158168
159169
160170
161- """ )
171+ """
172+ )
162173
163174UNIVERSAL = MAP .copy ()
164175
165176# get cpython versions
166- for abi_folder in Path ("." ).glob ("cp* " ):
177+ for abi_folder in Path ("." ).glob ("cp3?? " ):
167178 print (abi_folder )
168179
169180 MAP = UNIVERSAL .copy ()
170181
171182 # grab only python-wasm-sdk wheels and pyodide generated one -emscripten_3_M_mm_wasm32.whl
172183 # for matching version
173184
174- for whl in Path ( "." ). glob ( f"{ abi_folder } /*wasm32*.whl" ) :
175-
176- whlname = whl .as_posix ()
185+ for repo in [ f" { abi_folder } /*wasm32*.whl" , f"{ abi_folder } - { pygbag . VERSION } /*wasm32*.whl" ] :
186+ for whl in Path ( "." ). glob ( repo ):
187+ whlname = whl .as_posix ()
177188
178- if not whlname .find ('-abi3-' )> 0 :
189+ if not whlname .find ("-abi3-" ) > 0 :
190+ # 0.9 drop 3.10 & 3.11
191+ if whlname .find ("-cp310" ) > 0 :
192+ continue
179193
180- # 0.9 drop 3.11
181- if whlname .find ('-cp310' )> 0 :
182- continue
194+ if whlname .find ("-cp311" ) > 0 :
195+ continue
183196
184- if whlname . find ( '- cp311' ) > 0 :
185- continue
197+ for replace in ( "-cp310" , "- cp311" , "-cp312" , "-cp313" ) :
198+ whlname = whlname . replace ( replace , "-<abi>" )
186199
187- for replace in ("-cp310" , "-cp311" , "-cp312" , "-cp313" ):
188- whlname = whlname .replace (replace , "-<abi>" )
189-
190- whlname = whlname .replace ("-wasm32_bi_emscripten" , "-<api>" )
191-
192-
193- process_wheel (whl , whlname )
200+ whlname = whlname .replace ("-wasm32_bi_emscripten" , "-<api>" )
194201
202+ process_wheel (whl , whlname )
195203
196204 # input()
197205
@@ -202,8 +210,5 @@ def process_wheel(whl, whlname):
202210 for k , v in MAP .items ():
203211 print (k , v )
204212
205- with open (f"index-090 -{ abi_folder } .json" , "w" ) as f :
213+ with open (f"index-{ pygbag . VERSION } -{ abi_folder } .json" , "w" ) as f :
206214 print (json .dumps (MAP , sort_keys = True , indent = 4 ), file = f )
207-
208-
209-
0 commit comments