diff --git a/packages/micropip/test_micropip.py b/packages/micropip/test_micropip.py index c46ecd0a9..c774ea87a 100644 --- a/packages/micropip/test_micropip.py +++ b/packages/micropip/test_micropip.py @@ -1,4 +1,3 @@ -import time import sys from pathlib import Path @@ -14,7 +13,6 @@ def selenium_standalone_micropip(selenium_standalone): """ selenium_standalone.run_js( """ - await languagePluginLoader; await pyodide.loadPackage("micropip"); await pyodide.runPythonAsync("import micropip"); """ diff --git a/src/pyodide.js b/src/pyodide.js index 77f416841..db39ebe6a 100644 --- a/src/pyodide.js +++ b/src/pyodide.js @@ -33,7 +33,12 @@ globalThis.loadPyodide = async function(config = {}) { // in this template in the Makefile. It's recommended to always set // indexURL in any case. let baseURL = config.indexURL || "{{ PYODIDE_BASE_URL }}"; - baseURL = baseURL.substr(0, baseURL.lastIndexOf('/')) + '/'; + if (baseURL.endsWith(".js")) { + baseURL = baseURL.substr(0, baseURL.lastIndexOf('/')); + } + if (!baseURL.endsWith("/")) { + baseURL += '/'; + } //////////////////////////////////////////////////////////// // Package loading @@ -794,13 +799,14 @@ def temp(Module): if (globalThis.languagePluginUrl) { console.warn( - "languagePluginUrl is deprecated and will be removed in version 0.18.0," + + "languagePluginUrl is deprecated and will be removed in version 0.18.0, " + "instead use loadPyodide({ indexURL : })"); /** - * A deprecated parameter that specifies the Pyodide baseURL. If present, - * Pyodide will automatically invoke ``initializePyodide({baseURL : - * languagePluginUrl})`` and will store the resulting promise in + * A deprecated parameter that specifies the Pyodide indexURL. If present, + * Pyodide will automatically invoke + * ``initializePyodide({indexURL : languagePluginUrl})`` + * and will store the resulting promise in * :any:`globalThis.languagePluginLoader`. Instead, use :any:`loadPyodide` * directly. * @@ -818,5 +824,5 @@ if (globalThis.languagePluginUrl) { * @deprecated Will be removed in version 0.18.0 */ globalThis.languagePluginLoader = - loadPyodide({baseURL : globalThis.languagePluginUrl}); + loadPyodide({indexURL : globalThis.languagePluginUrl}); }