Skip to content

Commit

Permalink
0.3.2 pygame-script fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
pmp-p committed Sep 14, 2022
1 parent 2cd757a commit 5f08f9c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pygbag/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
""" packager+server for pygbag wasm loader """

__version__ = "0.3.1"
__version__ = "0.3.2"


# WaPy=>CPython compat
Expand Down
15 changes: 11 additions & 4 deletions pygbag/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@

from .__init__ import __version__

import pygbag

from . import pack
from . import web



devmode = "--dev" in sys.argv

cdn_dot = __version__.split('.')
cdn_dot = __version__.split(".")
cdn_dot.pop()
cdn_version = '.'.join(cdn_dot)
cdn_version = ".".join(cdn_dot)
del cdn_dot


if devmode:
sys.argv.remove("--dev")
DEFAULT_PORT = 8666
Expand Down Expand Up @@ -252,7 +255,6 @@ async def main_run(patharg, cdn=DEFAULT_CDN):
"""
)

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

CC = {
"cdn": args.cdn,
Expand All @@ -271,6 +273,11 @@ async def main_run(patharg, cdn=DEFAULT_CDN):
"PYBUILD": args.PYBUILD,
}

pygbag.config = CC

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


def cache_file(remote_url, suffix):
nonlocal cache_dir
cache = hashlib.md5(remote_url.encode()).hexdigest()
Expand Down
3 changes: 2 additions & 1 deletion pygbag/html_embed.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path

import pygbag

def dump_fs(html, target_folder, packlist):
html.write(
Expand Down Expand Up @@ -59,7 +60,7 @@ def make_header(html, line):
# found script directives after #!
SCRIPT = line[2:].strip()
else:
SCRIPT = ' src="https://pygame-web.github.io/archives/0.3.0/pythons.js"'
SCRIPT = f' src="{pygbag.config["cdn"]}pythons.js"'
SCRIPT += ' data-src="vtx,fs,gui"'

line = (
Expand Down
9 changes: 5 additions & 4 deletions pygbag/testserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import hashlib
from pathlib import Path


VERB = True
CACHE = None

Expand Down Expand Up @@ -192,10 +193,10 @@ def send_head(self):
content = f.read()

# redirect known CDN to relative path
# FIXME: py*-scripts
# content = content.replace(
# b"https://pygame-web.github.io", b"http://localhost:8000"
# )
# FIXME: py*-scripts
# content = content.replace(
# b"https://pygame-web.github.io", b"http://localhost:8000"
# )

# redirect user CDN to localhost
content = content.replace(BCDN, BPROXY)
Expand Down
4 changes: 0 additions & 4 deletions test/static/test.html

This file was deleted.

0 comments on commit 5f08f9c

Please sign in to comment.