Commit cf8d6c8a authored by Romain Casati's avatar Romain Casati
Browse files

Important fixes in packages.

parent 22f8115e
......@@ -2,6 +2,7 @@ import pydoc
import builtins
import sys
from js import window
from . import packages
__author__ = "Romain Casati"
......@@ -47,7 +48,7 @@ def hack_help():
def _hacked_help(*args, **kwargs):
backup = sys.builtin_module_names
to_add = [x for x in window.Basthon.packages.all if '.' not in x]
to_add = [x for x in packages._all_pkgs if '.' not in x]
to_add.append('js')
sys.builtin_module_names = backup + tuple(to_add)
res = _default_help(*args, **kwargs)
......
......@@ -21,7 +21,7 @@ __all__ = ["find_imports", "load_and_hack"]
_import_name_to_package_name = js.pyodide._module.packages.import_name_to_package_name
_import_name_to_package_name = {k: _import_name_to_package_name[k]
for k in dir(_import_name_to_package_name)
if not k.startswith('_')}
if isinstance(_import_name_to_package_name[k], str)}
# Available packages in Pyodide.
_pyodide_pkgs = set(_import_name_to_package_name.keys())
......@@ -59,7 +59,7 @@ _internal_pkgs = {
}
# Union of internal and pyodide packages.
_all_pkgs = _pyodide_pkgs & set(_internal_pkgs.keys())
_all_pkgs = _pyodide_pkgs | set(_internal_pkgs.keys())
# Packages already loaded.
_loaded = set()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment