Skip to content

Commit 30efd05

Browse files
authored
avoid name clashes (#91)
* avoid name clashes
1 parent 9ec5557 commit 30efd05

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

environment-dev_3.1.45.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
- yarn
99
- click
1010
- empack >=3.0.1
11-
- microsoft::playwright
11+
- microsoft::playwright <= 1.50
1212
- ninja
1313
- nodejs
1414
- pyjs_code_runner >= 2.0.1

environment-dev_3.1.58.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ dependencies:
88
- yarn
99
- click
1010
- empack >=3.0.1
11-
- microsoft::playwright
11+
- microsoft::playwright <= 1.50
1212
- ninja
1313
- nodejs
1414
- pyjs_code_runner >= 2.0.1

include/pyjs/pre_js/dynload/dynload.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,18 @@ async function loadDynlib(prefix, lib, global, searchDirs, readFileFunc) {
202202
const fs = createDynlibFS(prefix, lib, searchDirs, readFileFunc);
203203

204204
const libName = Module.PATH.basename(lib);
205-
//console.log(`load ${lib} (${libName}) `)
205+
206+
// contains cpython-3 and with wasm32-emscripten
207+
const is_cython_lib = libName.includes("cpython-3") && libName.includes("wasm32-emscripten");
208+
209+
// load cython library from full path
210+
const load_name = is_cython_lib ? lib : libName;
206211

207-
await Module.loadDynamicLibrary(libName, {
212+
await Module.loadDynamicLibrary(load_name, {
208213
loadAsync: true,
209214
nodelete: true,
210215
allowUndefined: true,
211-
global: global,
216+
global: global && !is_cython_lib,
212217
fs: fs
213218
})
214219

@@ -219,13 +224,14 @@ async function loadDynlib(prefix, lib, global, searchDirs, readFileFunc) {
219224
console.execption(`Failed to load ${libName} from ${lib} LDSO not found`);
220225
}
221226

222-
if (!dsoOnlyLibName) {
227+
if(!is_cython_lib){
228+
if (!dsoOnlyLibName) {
229+
Module.LDSO.loadedLibsByName[libName] = dsoFullLib
230+
}
223231

224-
Module.LDSO.loadedLibsByName[libName] = dsoFullLib
225-
}
226-
227-
if(!dsoFullLib){
228-
Module.LDSO.loadedLibsByName[lib] = dsoOnlyLibName;
232+
if(!dsoFullLib){
233+
Module.LDSO.loadedLibsByName[lib] = dsoOnlyLibName;
234+
}
229235
}
230236
} finally {
231237
releaseDynlibLock();

0 commit comments

Comments
 (0)