Skip to content

Commit 4b113af

Browse files
committed
0.9.2
1 parent 9da289f commit 4b113af

File tree

22 files changed

+112
-104
lines changed

22 files changed

+112
-104
lines changed

scripts/build-loader.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -384,13 +384,6 @@ END
384384
done
385385
popd
386386
fi
387-
#echo "
388-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
389-
# emsdk tot js gen temp fix
390-
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
391-
#"
392-
# sed -i 's/_glfwSetWindowContentScaleCallback_sig=iii/_glfwSetWindowContentScaleCallback_sig="iii"/g' \
393-
# ${DIST_DIR}/python${PYMAJOR}${PYMINOR}/${MODE}.js
394387
du -hs ${DIST_DIR}/*
395388
else
396389
echo "pymain+loader linking failed"

src/pygbag/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@
2424
VERSION = "0.0.0"
2525

2626
# make aio available
27-
if not sys.platform in ('emscripten','wasi'):
27+
if not sys.platform in ("emscripten", "wasi"):
2828
# must be first for readline
29-
sys.path.insert(0, str(Path(__file__).parent / "support" ))
29+
sys.path.insert(0, str(Path(__file__).parent / "support"))
3030
sys.path.append(str(Path(__file__).parent / "support/cross"))
3131

3232

src/pygbag/__main__.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,7 @@ class fake_EventTarget:
139139
clients = {}
140140
events = []
141141

142-
async def process(self):
143-
...
142+
async def process(self): ...
144143

145144
def patch_platform_system():
146145
return "Emscripten"
@@ -180,8 +179,7 @@ def system(cls):
180179
return "Linux"
181180

182181
@classmethod
183-
def no_op(cls, *argv, **kw):
184-
...
182+
def no_op(cls, *argv, **kw): ...
185183

186184
run = no_op
187185

src/pygbag/aio.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@
3434
if aio.pep0723.Config.dev_mode:
3535
aio.pep0723.Config.PKG_INDEXES.extend(["http://localhost:8000/archives/repo/"])
3636
else:
37-
aio.pep0723.Config.PKG_INDEXES.extend([
38-
os.environ.get('PYGPY', "https://pygame-web.github.io/archives/repo/"),
39-
])
37+
aio.pep0723.Config.PKG_INDEXES.extend(
38+
[
39+
os.environ.get("PYGPY", "https://pygame-web.github.io/archives/repo/"),
40+
]
41+
)
4042

4143
import pygbag.__main__
4244

src/pygbag/app.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717

1818
from .__init__ import VERSION
1919

20-
if '--no_ssl_check' in sys.argv:
20+
if "--no_ssl_check" in sys.argv:
2121
import ssl
22+
2223
# ssl local server testing.
2324
ssl._create_default_https_context = ssl._create_unverified_context
24-
#os.environ["REQUESTS_CA_BUNDLE"]="/etc/ssl/certs/ca-bundle.crt"
25+
# os.environ["REQUESTS_CA_BUNDLE"]="/etc/ssl/certs/ca-bundle.crt"
2526
sys.argv.remove("--no_ssl_check")
2627

2728
import pygbag
@@ -396,12 +397,11 @@ async def main_run(app_folder, mainscript, cdn=DEFAULT_CDN):
396397
"spdx": "cookiecutter.spdx",
397398
"version": VERSION,
398399
"PYBUILD": args.PYBUILD,
399-
"COLUMNS" : args.COLUMNS,
400-
"LINES" : args.LINES,
401-
"CONSOLE" : args.CONSOLE,
400+
"COLUMNS": args.COLUMNS,
401+
"LINES": args.LINES,
402+
"CONSOLE": args.CONSOLE,
402403
}
403404

404-
405405
pygbag.config = CC
406406

407407
await pack.archive(f"{app_name}.apk", app_folder, build_dir)

src/pygbag/gathering.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
import os
22
from pathlib import Path
33

4+
45
class Error(Exception):
56
pass
67

8+
79
def gather(root: Path, *kw):
810
if root.is_file():
911
if root.name == "main.py":

src/pygbag/optimizing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"wav": "ogg",
3232
"bmp": "png",
3333
"mp3": "ogg",
34-
"xm" : "ogg",
34+
"xm": "ogg",
3535
}
3636

3737

src/pygbag/support/_xterm_parser/_types.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,15 @@
1111
class MessageTarget(Protocol):
1212
"""Protocol that must be followed by objects that can receive messages."""
1313

14-
async def _post_message(self, message: "Message") -> bool:
15-
...
14+
async def _post_message(self, message: "Message") -> bool: ...
1615

17-
def post_message(self, message: "Message") -> bool:
18-
...
16+
def post_message(self, message: "Message") -> bool: ...
1917

2018

2119
class EventTarget(Protocol):
22-
async def _post_message(self, message: "Message") -> bool:
23-
...
20+
async def _post_message(self, message: "Message") -> bool: ...
2421

25-
def post_message(self, message: "Message") -> bool:
26-
...
22+
def post_message(self, message: "Message") -> bool: ...
2723

2824

2925
class UnusedParameter:

src/pygbag/support/cpythonrc.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def dump_code():
219219
else:
220220

221221
# for the various emulations/tools provided
222-
sys.path.append('/data/data/org.python/assets')
222+
sys.path.append("/data/data/org.python/assets")
223223

224224
PyConfig["pkg_repolist"] = []
225225

@@ -253,9 +253,9 @@ def dump_code():
253253
del home
254254

255255
# now in pep0723
256-
#PYCONFIG_PKG_INDEXES = [
256+
# PYCONFIG_PKG_INDEXES = [
257257
# os.environ.get('PYGPY', "https://pygame-web.github.io/archives/repo/"),
258-
#]
258+
# ]
259259

260260
PyConfig["imports_ready"] = False
261261
PyConfig["pygbag"] = 0
@@ -688,8 +688,8 @@ async def preload_code(cls, code, callback=None, loaderhome=".", hint=""):
688688
if not len(Config.repos):
689689
await aio.pep0723.async_repos()
690690

691-
# TODO switch to METADATA:Requires-Dist
692-
# see https://github.com/pygame-web/pygbag/issues/156
691+
# TODO switch to METADATA:Requires-Dist
692+
# see https://github.com/pygame-web/pygbag/issues/156
693693

694694
for cdn in Config.PKG_INDEXES:
695695
async with platform.fopen(Path(cdn) / Config.REPO_DATA) as source:
@@ -708,13 +708,13 @@ async def preload_code(cls, code, callback=None, loaderhome=".", hint=""):
708708
DBG(f"635: {maybe_wanted=} known failed {aio.pep0723.hint_failed=}")
709709

710710
# FIXME use an hybrid wheel
711-
if 'pyodide' in aio.pep0723.hint_failed:
711+
if "pyodide" in aio.pep0723.hint_failed:
712712

713-
for no_need in ('_zengl','pyodide','beautifulsoup4'):
713+
for no_need in ("_zengl", "pyodide", "beautifulsoup4"):
714714
if no_need in maybe_wanted:
715715
maybe_wanted.remove(no_need)
716716
# force
717-
maybe_wanted.append('beautifulsoup4')
717+
maybe_wanted.append("beautifulsoup4")
718718

719719
for dep in maybe_wanted:
720720
if not dep in deps:
@@ -1073,10 +1073,10 @@ def urlretrieve(maybe_url, filename=None, reporthook=None, data=None):
10731073
PyConfig.pkg_indexes.append(redirect)
10741074

10751075
print("807: DEV MODE ON", PyConfig.pkg_indexes)
1076-
# now in pep0723
1077-
# else:
1078-
# # address cdn
1079-
# PyConfig.pkg_indexes = PYCONFIG_PKG_INDEXES
1076+
# now in pep0723
1077+
# else:
1078+
# # address cdn
1079+
# PyConfig.pkg_indexes = PYCONFIG_PKG_INDEXES
10801080

10811081
from platform import window, document, ffi
10821082

@@ -1375,6 +1375,7 @@ def __call__(self, callid, fn, *argv, **env):
13751375
return None
13761376

13771377
print(f"{self.__dlref}.{fn}({argv},{env}) {callid=}")
1378+
13781379
async def rv():
13791380
obj = await platform.jsiter(window.dlcall(callid, jshex))
13801381
return json.loads(obj)
@@ -1475,6 +1476,7 @@ def log(*argv, **kw):
14751476
LOCK
14761477
except:
14771478
import builtins
1479+
14781480
builtins.LOCK = False
14791481

14801482

@@ -1617,7 +1619,7 @@ async def main():
16171619
local = tmpdir / file
16181620
break
16191621
DBG("1862: import_site: found ", local)
1620-
elif str(source).startswith('http'):
1622+
elif str(source).startswith("http"):
16211623
print("Remote file :", source)
16221624
local = tmpdir / "remote.py"
16231625
await shell.exec(shell.wget(f"-O{local}", source))

src/pygbag/support/cross/__EMSCRIPTEN__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def requestAnimationFrame(fn):
9696
async def main():
9797
while not aio.exit:
9898
if len(AnimatedFrames):
99-
frames.append( AnimatedFrames.pop(0) )
99+
frames.append(AnimatedFrames.pop(0))
100100
await asyncio.sleep(0)
101101

102102
asyncio.run(main())
@@ -105,7 +105,7 @@ async def main():
105105

106106
# just a workaround until bridge support js "options" from **kw
107107
def ffi(arg=0xDEADBEEF, **kw):
108-
if arg==0xDEADBEEF:
108+
if arg == 0xDEADBEEF:
109109
return window.JSON.parse(json.dumps(kw))
110110
return window.JSON.parse(json.dumps(arg))
111111

0 commit comments

Comments
 (0)