Commit 3b429e61 authored by Roman Yurchak's avatar Roman Yurchak

Address review comments

parent 0c6b653f
export PATH := $(PYODIDE_ROOT)/ccache:$(PYODIDE_ROOT)/emsdk/emsdk:$(PYODIDE_ROOT)/emsdk/emsdk/clang/tag-e1.38.10/build_tag-e1.38.10_64/bin:$(PYODIDE_ROOT)/emsdk/emsdk/node/8.9.1_64bit/bin:$(PYODIDE_ROOT)/emsdk/emsdk/emscripten/tag-1.38.10:$(PYODIDE_ROOT)/emsdk/emsdk/binaryen/tag-1.38.10_64bit_binaryen/bin:$(PATH) export PATH := $(PYODIDE_ROOT)/ccache:$(PYODIDE_ROOT)/emsdk/emsdk:$(PYODIDE_ROOT)/emsdk/emsdk/clang/tag-e1.38.10/build_tag-e1.38.10_64/bin:$(PYODIDE_ROOT)/emsdk/emsdk/node/8.9.1_64bit/bin:$(PYODIDE_ROOT)/emsdk/emsdk/emscripten/tag-1.38.10:$(PYODIDE_ROOT)/emsdk/emsdk/binaryen/tag-1.38.10_64bit_binaryen/bin:$(PATH)
export PYTHONPATH := $(PYTHONPATH):$(PYODIDE_ROOT)/
export EMSDK = $(PYODIDE_ROOT)/emsdk/emsdk export EMSDK = $(PYODIDE_ROOT)/emsdk/emsdk
export EM_CONFIG = $(PYODIDE_ROOT)/emsdk/emsdk/.emscripten export EM_CONFIG = $(PYODIDE_ROOT)/emsdk/emsdk/.emscripten
......
#!/bin/sh
# get the absolute path to the root directory
ROOTDIR="$(cd ${BASH_SOURCE%/*}/../; pwd)";
export PYTHONPATH="${PYTHONPATH}:${ROOTDIR}"
python -m pyodide_build "$@"
...@@ -2,7 +2,7 @@ PYODIDE_ROOT=$(abspath ..) ...@@ -2,7 +2,7 @@ PYODIDE_ROOT=$(abspath ..)
include ../Makefile.envs include ../Makefile.envs
all: all:
python -m pyodide_build buildall . ../build \ ../bin/pyodide buildall . ../build \
--ldflags="$(SIDE_LDFLAGS)" --host=$(HOSTPYTHONROOT) --target=$(TARGETPYTHONROOT) --ldflags="$(SIDE_LDFLAGS)" --host=$(HOSTPYTHONROOT) --target=$(TARGETPYTHONROOT)
clean: clean:
......
...@@ -7,7 +7,7 @@ from . import pywasmcross ...@@ -7,7 +7,7 @@ from . import pywasmcross
def main(): def main():
main_parser = argparse.ArgumentParser() main_parser = argparse.ArgumentParser(prog='pyodide')
subparsers = main_parser.add_subparsers(help='action') subparsers = main_parser.add_subparsers(help='action')
for command_name, module in (("buildpkg", buildpkg), for command_name, module in (("buildpkg", buildpkg),
......
...@@ -85,8 +85,7 @@ def compile(path, srcpath, pkg, args): ...@@ -85,8 +85,7 @@ def compile(path, srcpath, pkg, args):
try: try:
subprocess.run([ subprocess.run([
str(Path(args.host) / 'bin' / 'python3'), str(Path(args.host) / 'bin' / 'python3'),
'-m', 'pyodide_build', '-m', 'pyodide_build', 'pywasmcross',
'pywasmcross',
'--cflags', '--cflags',
args.cflags + ' ' + args.cflags + ' ' +
pkg.get('build', {}).get('cflags', ''), pkg.get('build', {}).get('cflags', ''),
......
...@@ -208,25 +208,30 @@ def build_wrap(args): ...@@ -208,25 +208,30 @@ def build_wrap(args):
def make_parser(parser): def make_parser(parser):
parser.description = ( basename = Path(sys.argv[0]).name
'Cross compile a Python distutils package. ' if basename in symlinks:
'Run from the root directory of the package\'s source') # skip parsing of all arguments
parser.add_argument( parser._actions = []
'--cflags', type=str, nargs='?', default=common.DEFAULTCFLAGS, else:
help='Extra compiling flags') parser.description = (
parser.add_argument( 'Cross compile a Python distutils package. '
'--ldflags', type=str, nargs='?', default=common.DEFAULTLDFLAGS, 'Run from the root directory of the package\'s source')
help='Extra linking flags') parser.add_argument(
parser.add_argument( '--cflags', type=str, nargs='?', default=common.DEFAULTCFLAGS,
'--host', type=str, nargs='?', default=common.HOSTPYTHON, help='Extra compiling flags')
help='The path to the host Python installation') parser.add_argument(
parser.add_argument( '--ldflags', type=str, nargs='?', default=common.DEFAULTLDFLAGS,
'--target', type=str, nargs='?', default=common.TARGETPYTHON, help='Extra linking flags')
help='The path to the target Python installation') parser.add_argument(
'--host', type=str, nargs='?', default=common.HOSTPYTHON,
help='The path to the host Python installation')
parser.add_argument(
'--target', type=str, nargs='?', default=common.TARGETPYTHON,
help='The path to the target Python installation')
return parser return parser
def main(args, unknown=None): def main(args):
basename = Path(sys.argv[0]).name basename = Path(sys.argv[0]).name
if basename in symlinks: if basename in symlinks:
collect_args(basename) collect_args(basename)
...@@ -235,6 +240,10 @@ def main(args, unknown=None): ...@@ -235,6 +240,10 @@ def main(args, unknown=None):
if __name__ == '__main__': if __name__ == '__main__':
parser = make_parser(argparse.ArgumentParser()) basename = Path(sys.argv[0]).name
args, unknown = parser.parse_known_args() if basename in symlinks:
main(args, unknown) main(None)
else:
parser = make_parser(argparse.ArgumentParser())
args = parser.parse_args()
main(args)
from setuptools import setup
import sys
from pyodide_build import __version__
if 'install' in sys.argv or 'bdist_wheel' in sys.argv:
print("Error: pyodode_build is currently not fully standalone, "
"and can only be installed in development mode. Use:\n"
" pip install -e . \n"
"to install it.")
sys.exit(1)
with open('README.md', 'rt') as fh:
LONG_DESCRIPTION = fh.read()
setup(name='pyodide_build',
version=__version__,
description='pyodide builder',
entry_points={
'console_scripts': [
'pyodide = pyodide_build.__main__:main'
]},
url="https://github.com/iodide-project/pyodide",
license='MPL',
packages=['pyodide_build'])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment