pyodide/tools/common.py

29 lines
814 B
Python
Raw Normal View History

2018-06-20 18:54:47 +00:00
import os
2018-06-20 19:05:13 +00:00
2018-06-20 18:54:47 +00:00
ROOTDIR = os.path.abspath(os.path.dirname(__file__))
2018-06-20 19:05:13 +00:00
HOSTPYTHON = os.path.abspath(
os.path.join(ROOTDIR, '..', 'cpython', 'build', '3.6.4', 'host'))
TARGETPYTHON = os.path.abspath(
os.path.join(ROOTDIR, '..', 'cpython', 'installs', 'python-3.6.4'))
DEFAULTCFLAGS = ''
DEFAULTLDFLAGS = ' '.join([
2018-06-20 18:54:47 +00:00
'-O3',
'-s', "BINARYEN_METHOD='native-wasm'",
2018-06-20 19:05:13 +00:00
'-Werror',
2018-06-20 18:54:47 +00:00
'-s', 'EMULATED_FUNCTION_POINTERS=1',
'-s', 'EMULATE_FUNCTION_POINTER_CASTS=1',
'-s', 'SIDE_MODULE=1',
'-s', 'WASM=1',
'--memory-init-file', '0'
])
def parse_package(package):
2018-06-22 18:49:52 +00:00
# Import yaml here because pywasmcross needs to run in the built native
# Python, which won't have PyYAML
import yaml
2018-06-20 18:54:47 +00:00
# TODO: Validate against a schema
with open(package) as fd:
return yaml.load(fd)