Skip to content

Commit 0cad6af

Browse files
committed
0.8.0 WIP
1 parent beb161b commit 0cad6af

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

purescripto/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
from purescripto.purescript_loader import LoadPureScript
2-
from purescripto.utilities import auto_link_repo
1+
from purescripto.purescript_loader import LoadPureScript
2+
from purescripto.utilities import auto_link_repo

purescripto/purescript_loader.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
from py_sexpr.stack_vm.emit import module_code
1010
from purescripto.topdown import load_topdown
1111
import marshal
12+
import zipfile
13+
import io
1214
import functools
1315

1416
RES = "res"
@@ -53,12 +55,13 @@ def source_to_prog(self, src: bytes, path: Path) -> CodeType:
5355
if path.name.endswith(".raw.py"):
5456
meta_code = compile(src, filename, "eval")
5557
sexpr = eval(meta_code, META_ENV)
56-
code = module_code(sexpr, name=self.qualified_name + "$", filename=filename)
5758
else:
5859
assert path.name.endswith(".zip.py")
59-
with path.open(mode="utf8") as f:
60-
code = load_topdown(f, META_ENV)
60+
zip = zipfile.ZipFile(filename)
61+
file = io.StringIO(zip.read('source').decode('utf8'))
62+
sexpr = load_topdown(file, META_ENV)
6163

64+
code = module_code(sexpr, name=self.qualified_name + "$", filename=filename)
6265
return code
6366

6467
def load_program(self, b: bytes) -> CodeType:

purescripto/topdown.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def read_int(readline=readline, append=push_object):
5050

5151
# noinspection PyDefaultArgument
5252
def read_bool(
53-
readline=readline, mapping={"true": True, "false": False}, append=push_object,
53+
readline=readline, mapping={"t": True, "f": False}, append=push_object,
5454
):
5555
return append(mapping[readline()[:-1]])
5656

0 commit comments

Comments
 (0)