Skip to content

Commit

Permalink
fix platlib explorer for wasm streaming compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Nov 22, 2023
1 parent a4abc17 commit 31faf3f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 7 additions & 1 deletion pygbag/support/cross/aio/pep0723.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,12 @@ async def check_list(code=None, filename=None):
continue
await pip_install(pkg, sconf)

import platform
# wasm compilation
if not aio.cross.simulator:
import platform
import asyncio
platform.explore(sconf["platlib"])
await asyncio.sleep(0)

# apply any patches
while len(PATCHLIST):
Expand All @@ -419,6 +424,7 @@ async def check_list(code=None, filename=None):
print("-" * 40)
print()


return still_missing


Expand Down
11 changes: 7 additions & 4 deletions pygbag/support/cross/aio/toplevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ async def get_repo_pkg(pkg_file, pkg, resume, ex):
import sysconfig
import importlib
from pathlib import Path
import aio.pep0723

if not pkg_file in HISTORY:
sconf = sysconfig.get_paths()
Expand All @@ -74,22 +75,24 @@ async def get_repo_pkg(pkg_file, pkg, resume, ex):
pdb(f"75: failed to install {pkg_file}")
sys.print_exception(rx)

# let wasm compilation happen
await asyncio.sleep(0)

# wasm compilation
try:
platform.explore(platlib)
platform.explore(aio.pep0723.sconf["platlib"])
await asyncio.sleep(0)
importlib.invalidate_caches()
# print(f"{pkg_file} installed, preloading", embed.preloading())
except Exception as rx:
pdb(f"failed to preload {pkg_file}")
sys.print_exception(rx)
# let wasm compilation happen
await asyncio.sleep(0)
else:
print(f"90: {pkg_file} already installed")

if pkg in platform.patches:
print("93:", pkg, "requires patching")
print("92:", pkg, "requires patching")
await asyncio.sleep(0)
platform.patches.pop(pkg)()

if resume and ex:
Expand Down

0 comments on commit 31faf3f

Please sign in to comment.