Commit 7fac9662 authored by Michael Droettboom's avatar Michael Droettboom

Fix glitches in last few commits

parent cb939562
...@@ -63,16 +63,16 @@ def parse_args(): ...@@ -63,16 +63,16 @@ def parse_args():
'output', type=str, nargs=1, 'output', type=str, nargs=1,
help='Output directory in which to put all built packages') help='Output directory in which to put all built packages')
parser.add_argument( parser.add_argument(
'--cflags', type=str, nargs='?', default=[common.DEFAULTCFLAGS], '--cflags', type=str, nargs='?', default=common.DEFAULTCFLAGS,
help='Extra compiling flags') help='Extra compiling flags')
parser.add_argument( parser.add_argument(
'--ldflags', type=str, nargs='?', default=[common.DEFAULTLDFLAGS], '--ldflags', type=str, nargs='?', default=common.DEFAULTLDFLAGS,
help='Extra linking flags') help='Extra linking flags')
parser.add_argument( parser.add_argument(
'--host', type=str, nargs='?', default=[common.HOSTPYTHON], '--host', type=str, nargs='?', default=common.HOSTPYTHON,
help='The path to the host Python installation') help='The path to the host Python installation')
parser.add_argument( parser.add_argument(
'--target', type=str, nargs='?', default=[common.TARGETPYTHON], '--target', type=str, nargs='?', default=common.TARGETPYTHON,
help='The path to the target Python installation') help='The path to the target Python installation')
return parser.parse_args() return parser.parse_args()
......
...@@ -179,16 +179,16 @@ def parse_args(): ...@@ -179,16 +179,16 @@ def parse_args():
'package', type=str, nargs=1, 'package', type=str, nargs=1,
help="Path to meta.yaml package description") help="Path to meta.yaml package description")
parser.add_argument( parser.add_argument(
'--cflags', type=str, nargs='?', default=[common.DEFAULTCFLAGS], '--cflags', type=str, nargs='?', default=common.DEFAULTCFLAGS,
help='Extra compiling flags') help='Extra compiling flags')
parser.add_argument( parser.add_argument(
'--ldflags', type=str, nargs='?', default=[common.DEFAULTLDFLAGS], '--ldflags', type=str, nargs='?', default=common.DEFAULTLDFLAGS,
help='Extra linking flags') help='Extra linking flags')
parser.add_argument( parser.add_argument(
'--host', type=str, nargs='?', default=[common.HOSTPYTHON], '--host', type=str, nargs='?', default=common.HOSTPYTHON,
help='The path to the host Python installation') help='The path to the host Python installation')
parser.add_argument( parser.add_argument(
'--target', type=str, nargs='?', default=[common.TARGETPYTHON], '--target', type=str, nargs='?', default=common.TARGETPYTHON,
help='The path to the target Python installation') help='The path to the target Python installation')
return parser.parse_args() return parser.parse_args()
......
import os import os
import yaml
ROOTDIR = os.path.abspath(os.path.dirname(__file__)) ROOTDIR = os.path.abspath(os.path.dirname(__file__))
...@@ -21,6 +20,9 @@ DEFAULTLDFLAGS = ' '.join([ ...@@ -21,6 +20,9 @@ DEFAULTLDFLAGS = ' '.join([
def parse_package(package): def parse_package(package):
# Import yaml here because pywasmcross needs to run in the built native
# Python, which won't have PyYAML
import yaml
# TODO: Validate against a schema # TODO: Validate against a schema
with open(package) as fd: with open(package) as fd:
return yaml.load(fd) return yaml.load(fd)
...@@ -89,7 +89,7 @@ def capture_compile(args): ...@@ -89,7 +89,7 @@ def capture_compile(args):
env['PATH'] = ROOTDIR + ':' + os.environ['PATH'] env['PATH'] = ROOTDIR + ':' + os.environ['PATH']
result = subprocess.run( result = subprocess.run(
[os.path.join(args.host[0], 'bin', 'python3'), [os.path.join(args.host, 'bin', 'python3'),
'setup.py', 'setup.py',
'install'], env=env) 'install'], env=env)
if result.returncode != 0: if result.returncode != 0:
...@@ -119,9 +119,9 @@ def handle_command(line, args): ...@@ -119,9 +119,9 @@ def handle_command(line, args):
shared = '-shared' in line shared = '-shared' in line
if shared: if shared:
new_args.extend(args.ldflags[0].split()) new_args.extend(args.ldflags.split())
elif new_args[0] in ('emcc', 'em++'): elif new_args[0] in ('emcc', 'em++'):
new_args.extend(args.cflags[0].split()) new_args.extend(args.cflags.split())
# Go through and adjust arguments # Go through and adjust arguments
for arg in line[1:]: for arg in line[1:]:
...@@ -129,9 +129,9 @@ def handle_command(line, args): ...@@ -129,9 +129,9 @@ def handle_command(line, args):
# Don't include any system directories # Don't include any system directories
if arg[2:].startswith('/usr'): if arg[2:].startswith('/usr'):
continue continue
if (os.path.abspath(arg[2:]).startswith(args.host[0]) and if (os.path.abspath(arg[2:]).startswith(args.host) and
'site-packages' not in arg): 'site-packages' not in arg):
arg = arg.replace('-I' + args.host[0], '-I' + args.target[0]) arg = arg.replace('-I' + args.host, '-I' + args.target)
# Don't include any system directories # Don't include any system directories
if arg.startswith('-L/usr'): if arg.startswith('-L/usr'):
continue continue
...@@ -194,16 +194,16 @@ def parse_args(): ...@@ -194,16 +194,16 @@ def parse_args():
'Cross compile a Python distutils package. ' 'Cross compile a Python distutils package. '
'Run from the root directory of the package\'s source') 'Run from the root directory of the package\'s source')
parser.add_argument( parser.add_argument(
'--cflags', type=str, nargs='?', default=[common.DEFAULTCFLAGS], '--cflags', type=str, nargs='?', default=common.DEFAULTCFLAGS,
help='Extra compiling flags') help='Extra compiling flags')
parser.add_argument( parser.add_argument(
'--ldflags', type=str, nargs='?', default=[common.DEFAULTLDFLAGS], '--ldflags', type=str, nargs='?', default=common.DEFAULTLDFLAGS,
help='Extra linking flags') help='Extra linking flags')
parser.add_argument( parser.add_argument(
'--host', type=str, nargs='?', default=[common.HOSTPYTHON], '--host', type=str, nargs='?', default=common.HOSTPYTHON,
help='The path to the host Python installation') help='The path to the host Python installation')
parser.add_argument( parser.add_argument(
'--target', type=str, nargs='?', default=[common.TARGETPYTHON], '--target', type=str, nargs='?', default=common.TARGETPYTHON,
help='The path to the target Python installation') help='The path to the target Python installation')
args = parser.parse_args() args = parser.parse_args()
return args return args
......
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