File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,30 @@ def find_library(name):
8080 continue
8181 return None
8282
83+ elif os .name == "posix" and sys .platform == "emscripten" :
84+ def _is_wasm (filename ):
85+ # Return True if the given file is an WASM module
86+ wasm_header = b'\x00 asm'
87+ with open (filename , 'br' ) as thefile :
88+ return thefile .read (4 ) == wasm_header
89+
90+ def find_library (name ):
91+ possible = ['lib%s.so' % name ,
92+ 'lib%s.wasm' % name ]
93+
94+ paths = os .environ .get ('LD_LIBRARY_PATH' , '' )
95+ for dir in paths .split (":" ):
96+ for name in possible :
97+ libfile = os .path .join (dir , name )
98+
99+ if os .path .isfile (libfile ):
100+ if not _is_wasm (libfile ):
101+ continue
102+
103+ return libfile
104+
105+ return None
106+
83107elif sys .platform .startswith ("aix" ):
84108 # AIX has two styles of storing shared libraries
85109 # GNU auto_tools refer to these as svr4 and aix
You can’t perform that action at this time.
0 commit comments