[SCons] Install example input files from git submodule

This commit is contained in:
Ray Speth 2024-03-31 13:11:03 -04:00 committed by Ray Speth
parent 92d3aeca42
commit 9bbd0fac3d
5 changed files with 31 additions and 0 deletions

4
.gitmodules vendored
View File

@ -19,3 +19,7 @@
[submodule "ext/doxygen-awesome-css"]
path = ext/doxygen-awesome-css
url = https://github.com/jothepro/doxygen-awesome-css.git
[submodule "data/example-data"]
path = data/example_data
url = https://github.com/cantera/cantera-example-data
shallow = true

View File

@ -317,6 +317,12 @@ config_options = [
"""Options passed to the 'sphinx_cmd' command line. Separate multiple
options with spaces, for example, "-W --keep-going".""",
"-W --keep-going"),
BoolOption(
"example_data",
"""Install data files used in examples. These files will be accessible on the
Cantera data path using a prefix, such as 'example_data/mech.yaml'""",
True,
),
EnumOption(
"system_eigen",
"""Select whether to use Eigen from a system installation ('y'), from a
@ -2083,6 +2089,13 @@ elif env['OS'] == 'Darwin':
else:
env.PrependENVPath('LD_LIBRARY_PATH', Dir('#build/lib').abspath)
if (env["example_data"]
and not list(Path("data/example_data").glob("*.yaml"))
):
checkout_submodule("cantera-example-data", "data/example_data")
if addInstallActions:
# Put headers in place
install(env.RecursiveInstall, '$inst_incdir', 'include/cantera')
@ -2091,6 +2104,10 @@ if addInstallActions:
for yaml in multi_glob(env, "data", "yaml"):
install("$inst_datadir", yaml)
if env["example_data"]:
for yaml in multi_glob(env, "data/example_data", "yaml"):
install("$inst_datadir/example_data", yaml)
if env['system_sundials'] == 'y':
env['sundials_libs'] = ['sundials_cvodes', 'sundials_idas', 'sundials_nvecserial']

1
data/example_data Submodule

@ -0,0 +1 @@
Subproject commit d5c340e8f125a2660dc7f04cf35039f155d4b19e

View File

@ -15,6 +15,13 @@ for yaml in multi_glob(localenv, "#data", "yaml"):
localenv.Command(f"cantera/data/{yaml.name}", yaml.abspath,
Copy("$TARGET", "$SOURCE"))))
if localenv["example_data"]:
for yaml in multi_glob(localenv, "#data/example_data", "yaml"):
dataFiles.append(build(
localenv.Command(f"cantera/data/example_data/{yaml.name}", yaml.abspath,
Copy("$TARGET", "$SOURCE"))))
# Install Python samples
install(localenv.RecursiveInstall, "$inst_sampledir/python", "#samples/python")

View File

@ -47,6 +47,7 @@ python_requires @py_requires_ver_str@
packages =
cantera
cantera.data
cantera.data.example_data
cantera.test
cantera.examples
cantera.with_units
@ -57,6 +58,7 @@ packages =
# we have to treat the module as package data.
cantera = *.pxd, *.dll, *@py_module_ext@
cantera.data = *.*
cantera.data.example_data = *.*
cantera.test = *.txt
cantera.examples = *.txt