Skip to content

Commit

Permalink
[SCons] Install example input files from git submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed Apr 11, 2024
1 parent 92d3aec commit 9bbd0fa
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 17 additions & 0 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -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']
Expand Down
1 change: 1 addition & 0 deletions data/example_data
Submodule example_data added at d5c340
7 changes: 7 additions & 0 deletions interfaces/cython/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
2 changes: 2 additions & 0 deletions interfaces/cython/setup.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down

0 comments on commit 9bbd0fa

Please sign in to comment.