Skip to content

Commit b1cb688

Browse files
committed
Fix promise chain in python autogen
This fixes a race condition where the glob in `createPythonModuleInitFile` would not see all the generated files.
1 parent f6447de commit b1cb688

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

js/scripts/generate-wrappers.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -946,16 +946,18 @@ function createPythonFiles() {
946946
}
947947

948948
return mapPromiseFnOverThreeModules(function(relativePath) {
949-
createPythonWrapper(relativePath);
950-
// ensures each dir has empty __init__.py file for proper importing of sub dirs
951-
createPythonModuleInitFile(relativePath);
949+
return createPythonWrapper(relativePath).then(function() {
950+
// ensures each dir has empty __init__.py file for proper importing of sub dirs
951+
createPythonModuleInitFile(relativePath);
952+
});
952953
})
953954
.then(function() {
954955
return mapPromiseFnOverFileList(CUSTOM_CLASSES, function(relativePath) {
955-
createPythonWrapper(relativePath);
956-
// ensures each dir has empty __init__.py file for proper importing of sub dirs
957-
createPythonModuleInitFile(relativePath);
958-
})
956+
return createPythonWrapper(relativePath).then(function() {
957+
// ensures each dir has empty __init__.py file for proper importing of sub dirs
958+
createPythonModuleInitFile(relativePath);
959+
});
960+
});
959961
})
960962
.then(function() {
961963
// top level __init__.py file imports *all* pythreejs modules into namespace

0 commit comments

Comments
 (0)