-
Notifications
You must be signed in to change notification settings - Fork 2
/
python310.html
38 lines (26 loc) · 1.04 KB
/
python310.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<html><head><meta charset=utf-8></head><script src=/archives/0.5/pythons.js data-src=vtx,gui data-python=cpython3.10 type=module id=__main__ async defer>#<!--
import asyncio
from pathlib import Path
async def custom_site():
if sys.platform in ("emscripten","wasi",):
platform.window.python.is_ready = True
await shell.exec( shell.debug )
await TopLevel_async_handler.start_toplevel(platform.shell, console=True)
def ui_callback(pkg):
print(f"installing {pkg}")
if sys.argv[0].endswith('.py'):
tmpdir = Path(__import__("tempfile").gettempdir())
filename = tmpdir / sys.argv[0].rsplit('/',1)[-1]
await shell.exec( shell.wget(f"-O{filename}", sys.argv[0]) )
if os.path.isfile(filename):
print(sys.argv)
os.chdir(tmpdir)
if await shell.preload(filename, ui_callback):
await shell.source(filename)
else:
embed.prompt()
else:
embed.prompt()
asyncio.run(custom_site())
del custom_site
# --></script></html>