Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pyodide
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
pyodide
Commits
d9b590f5
Commit
d9b590f5
authored
Oct 29, 2018
by
Roman Yurchak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define build/skip_host meta.yaml option
parent
f6bd2170
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
9 deletions
+30
-9
docs/new_packages.md
docs/new_packages.md
+11
-0
packages/numpy/meta.yaml
packages/numpy/meta.yaml
+1
-0
pyodide_build/buildpkg.py
pyodide_build/buildpkg.py
+4
-1
pyodide_build/pywasmcross.py
pyodide_build/pywasmcross.py
+2
-8
test/test_common.py
test/test_common.py
+12
-0
No files found.
docs/new_packages.md
View file @
d9b590f5
...
...
@@ -90,6 +90,17 @@ source tree (the expanded tarball).
### `build`
#### `build/skip_host`
Skip building C extensions for the host environment. Default:
`True`
.
Setting this to
`False`
will result in ~2x slower builds for packages that
include C extensions. It should only be needed when a package is a build
time dependency for other packages. For instance, numpy is imported during
installation of matplotlib, importing numpy also imports included C extensions,
therefore it is built both for host and target.
#### `build/cflags`
Extra arguments to pass to the compiler when building for WebAssembly.
...
...
packages/numpy/meta.yaml
View file @
d9b590f5
...
...
@@ -18,6 +18,7 @@ source:
-
patches/fix-install-with-skip-build.patch
build
:
skip_host
:
False
cflags
:
-include math.h -I../../config
...
...
pyodide_build/buildpkg.py
View file @
d9b590f5
...
...
@@ -82,6 +82,9 @@ def compile(path, srcpath, pkg, args):
orig_dir
=
Path
.
cwd
()
os
.
chdir
(
srcpath
)
env
=
dict
(
os
.
environ
)
env
[
'SKIP_HOST'
]
=
str
(
pkg
.
get
(
'build'
,
{}).
get
(
'skip_host'
,
True
))
try
:
subprocess
.
run
([
str
(
Path
(
args
.
host
)
/
'bin'
/
'python3'
),
...
...
@@ -93,7 +96,7 @@ def compile(path, srcpath, pkg, args):
args
.
ldflags
+
' '
+
pkg
.
get
(
'build'
,
{}).
get
(
'ldflags'
,
''
),
'--host'
,
args
.
host
,
'--target'
,
args
.
target
],
check
=
True
)
'--target'
,
args
.
target
],
env
=
env
,
check
=
True
)
finally
:
os
.
chdir
(
orig_dir
)
...
...
pyodide_build/pywasmcross.py
View file @
d9b590f5
...
...
@@ -59,13 +59,7 @@ def collect_args(basename):
path
=
path
.
replace
(
str
(
ROOTDIR
)
+
':'
,
''
)
env
[
'PATH'
]
=
path
# determine the package name from the current directory
re_res
=
re
.
match
(
r'.*packages/(?P<name>[\
w
\-]+)/build.*'
,
env
[
'PWD'
])
if
re_res
:
package_name
=
re_res
.
group
(
'name'
)
else
:
package_name
=
None
skip_host
=
os
.
environ
.
get
(
'SKIP_HOST'
,
'True'
).
lower
()
==
'true'
# Skip compilations of C/Fortran extensions for the target environement.
# We still need to generate the output files for distutils to continue
...
...
@@ -79,7 +73,7 @@ def collect_args(basename):
and
'-o'
in
sys
.
argv
[
1
:]
# do not skip numpy as it is needed as build time
# dependency by other packages (e.g. matplotlib)
and
package_name
!=
'numpy'
):
and
skip_host
):
out_idx
=
sys
.
argv
.
index
(
'-o'
)
if
(
out_idx
+
1
)
<
len
(
sys
.
argv
):
# get the index of the output file path
...
...
test/test_common.py
View file @
d9b590f5
...
...
@@ -27,6 +27,18 @@ UNSUPPORTED_PACKAGES = {'chrome': ['pandas'],
'firefox'
:
[]}
@
pytest
.
mark
.
parametrize
(
'name'
,
registered_packages
())
def
test_parse_package
(
name
):
# check that we can parse the meta.yaml
meta
=
parse_package
(
PKG_DIR
/
name
/
'meta.yaml'
)
skip_host
=
meta
.
get
(
'build'
,
{}).
get
(
'skip_host'
,
True
)
if
name
==
'numpy'
:
assert
skip_host
is
False
elif
name
==
'pandas'
:
assert
skip_host
is
True
@
pytest
.
mark
.
parametrize
(
'name'
,
registered_packages
())
def
test_import
(
name
,
selenium_standalone
):
# check that we can parse the meta.yaml
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment