Some cleanup after #1363 (#1409)

This commit is contained in:
Hood Chatham 2021-04-01 03:55:18 -04:00 committed by GitHub
parent 67678a6c7f
commit 5b405767f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -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");
"""

View File

@ -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
@ -798,9 +803,10 @@ if (globalThis.languagePluginUrl) {
"instead use loadPyodide({ indexURL : <some_url>})");
/**
* 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});
}