diff --git a/.gitmodules b/.gitmodules index 8302fbd726..d9a5e06358 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/SConstruct b/SConstruct index 5d6342fbb5..4083ce2c48 100644 --- a/SConstruct +++ b/SConstruct @@ -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'] diff --git a/data/example_data b/data/example_data new file mode 160000 index 0000000000..d5c340e8f1 --- /dev/null +++ b/data/example_data @@ -0,0 +1 @@ +Subproject commit d5c340e8f125a2660dc7f04cf35039f155d4b19e diff --git a/interfaces/cython/SConscript b/interfaces/cython/SConscript index 675d1aaa54..2e87af8410 100644 --- a/interfaces/cython/SConscript +++ b/interfaces/cython/SConscript @@ -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") diff --git a/interfaces/cython/setup.cfg.in b/interfaces/cython/setup.cfg.in index b1ade6d497..a6beea6b27 100644 --- a/interfaces/cython/setup.cfg.in +++ b/interfaces/cython/setup.cfg.in @@ -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