File tree Expand file tree Collapse file tree 1 file changed +4
-30
lines changed
Expand file tree Collapse file tree 1 file changed +4
-30
lines changed Original file line number Diff line number Diff line change 33
44async def setup ():
55 """Load dynamic libraries in the pyodide-pack bundle"""
6- try :
7- from pyodide_js import _module
6+ from pyodide_js import _module
87
9- # We need to handle duplicate shared libraries carefully. Many packages
10- # that depend on static/shared libraries like h5py and netcdf4 may include
11- # them (such as libhdf5_hl.so); loading them more than once, especially one
12- # by one instead of their dependent order may cause errors.
13-
14- loaded_libs = set ()
15- so_list_path = Path ("/bundle-so-list.txt" )
16- if not so_list_path .exists ():
17- print (f"Warning: { so_list_path } not found" )
18- return
19-
20- for line in so_list_path .read_text ().splitlines ():
21- try :
22- path , is_shared = line .split ("," )
23-
24- if path in loaded_libs :
25- continue
26-
27- lib_basename = Path (path ).name
28- if any (lib_basename == Path (loaded ).name for loaded in loaded_libs ):
29- continue
30-
31- await _module .API .loadDynlib (path , bool (is_shared ))
32- loaded_libs .add (path )
33- except Exception as e :
34- print (f"Warning: Failed to load { path } : { str (e )} " )
35- except Exception as e :
36- print (f"Error in setup: { str (e )} " )
8+ for paths in Path ("/bundle-so-list.txt" ).read_text ().splitlines ():
9+ path , is_shared = paths .split ("," )
10+ await _module .API .loadDynlib (path , bool (is_shared ))
You can’t perform that action at this time.
0 commit comments