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

Remove submodules from Pyodide's package list.

parent f99abf99
......@@ -48,7 +48,7 @@ def hack_help():
def _hacked_help(*args, **kwargs):
backup = sys.builtin_module_names
to_add = [x for x in packages._all_pkgs if '.' not in x]
to_add = list(packages._all_pkgs)
to_add.append('js')
sys.builtin_module_names = backup + tuple(to_add)
res = _default_help(*args, **kwargs)
......
......@@ -112,11 +112,11 @@ def importables():
""" List of all importable modules. """
import sys
import pkgutil
import js
from . import packages
from_sys = set(x for x in sys.modules.keys() if '.' not in x)
from_pkgutil = set(p.name for p in pkgutil.iter_modules())
from_basthon_js = set(x for x in js.window.Basthon.packages.all if '.' not in x)
return sorted(from_sys.union(from_pkgutil, from_basthon_js))
from_basthon = packages._all_pkgs
return sorted(from_sys.union(from_pkgutil, from_basthon))
def restart():
......
......@@ -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 isinstance(_import_name_to_package_name[k], str)}
if isinstance(_import_name_to_package_name[k], str) and '.' not in k}
# Available packages in Pyodide.
_pyodide_pkgs = set(_import_name_to_package_name.keys())
......
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