2021-03-26 14:37:59 +00:00
|
|
|
from pyodide_build.common import (
|
|
|
|
_parse_package_subset,
|
|
|
|
get_make_flag,
|
|
|
|
get_make_environment_vars,
|
|
|
|
) # noqa
|
2020-05-08 23:28:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_parse_package_subset():
|
|
|
|
# micropip is always included
|
2020-05-12 10:33:20 +00:00
|
|
|
assert _parse_package_subset("numpy,pandas") == {
|
2021-04-14 18:15:31 +00:00
|
|
|
"pyparsing",
|
|
|
|
"packaging",
|
2020-06-28 18:24:40 +00:00
|
|
|
"micropip",
|
|
|
|
"numpy",
|
|
|
|
"pandas",
|
2020-05-12 10:33:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# duplicates are removed
|
2021-04-14 18:15:31 +00:00
|
|
|
assert _parse_package_subset("numpy,numpy") == {
|
|
|
|
"pyparsing",
|
|
|
|
"packaging",
|
|
|
|
"micropip",
|
|
|
|
"numpy",
|
|
|
|
}
|
2021-03-20 18:00:35 +00:00
|
|
|
|
|
|
|
# no empty package name included, spaces are handled
|
|
|
|
assert _parse_package_subset("x, a, b, c ,,, d,,") == {
|
2021-04-14 18:15:31 +00:00
|
|
|
"pyparsing",
|
|
|
|
"packaging",
|
2021-03-20 18:00:35 +00:00
|
|
|
"micropip",
|
|
|
|
"x",
|
|
|
|
"a",
|
|
|
|
"b",
|
|
|
|
"c",
|
|
|
|
"d",
|
|
|
|
}
|
2021-09-02 20:19:23 +00:00
|
|
|
|
|
|
|
assert _parse_package_subset("core") == {
|
|
|
|
"pyparsing",
|
|
|
|
"packaging",
|
|
|
|
"pytz",
|
|
|
|
"Jinja2",
|
|
|
|
"micropip",
|
2021-09-21 06:47:48 +00:00
|
|
|
"regex",
|
2021-09-02 20:19:23 +00:00
|
|
|
}
|
|
|
|
# by default core packages are built
|
|
|
|
assert _parse_package_subset(None) == _parse_package_subset("core")
|
|
|
|
|
|
|
|
assert _parse_package_subset("min-scipy-stack") == {
|
|
|
|
"pyparsing",
|
|
|
|
"packaging",
|
|
|
|
"pytz",
|
|
|
|
"Jinja2",
|
|
|
|
"micropip",
|
2021-09-21 06:47:48 +00:00
|
|
|
"regex",
|
2021-09-02 20:19:23 +00:00
|
|
|
"numpy",
|
|
|
|
"scipy",
|
|
|
|
"pandas",
|
|
|
|
"matplotlib",
|
|
|
|
"scikit-learn",
|
|
|
|
"joblib",
|
|
|
|
"pytest",
|
|
|
|
}
|
|
|
|
# reserved key words can be combined with other packages
|
|
|
|
assert _parse_package_subset("core, unknown") == _parse_package_subset("core") | {
|
|
|
|
"unknown"
|
|
|
|
}
|
2021-03-26 14:37:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_make_flag():
|
|
|
|
assert len(get_make_flag("SIDE_MODULE_LDFLAGS")) > 0
|
|
|
|
assert len(get_make_flag("SIDE_MODULE_CFLAGS")) > 0
|
|
|
|
# n.b. right now CXXFLAGS is empty so don't check length here, just check it returns
|
|
|
|
get_make_flag("SIDE_MODULE_CXXFLAGS")
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_make_environment_vars():
|
|
|
|
vars = get_make_environment_vars()
|
|
|
|
assert "SIDE_MODULE_LDFLAGS" in vars
|
|
|
|
assert "SIDE_MODULE_CFLAGS" in vars
|
|
|
|
assert "SIDE_MODULE_CXXFLAGS" in vars
|
|
|
|
assert "TOOLSDIR" in vars
|