Skip to content

Commit

Permalink
[samples] Move Python examples to standard location and update SCons
Browse files Browse the repository at this point in the history
  • Loading branch information
ischoegl committed Aug 6, 2022
1 parent fdb7d3d commit b7f582b
Show file tree
Hide file tree
Showing 57 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ jobs:
- name: Run the examples
# See https://unix.stackexchange.com/a/392973 for an explanation of the -exec part
run: |
find interfaces/cython/cantera/examples -type f -iname "*.py" \
find samples/python -type f -iname "*.py" \
-exec sh -c 'for n; do echo "$n" | tee -a results.txt && python3 "$n" >> results.txt || exit 1; done' sh {} +
env:
PYTHONPATH: build/python
Expand Down Expand Up @@ -364,6 +364,7 @@ jobs:
test -f ${CONDA_PREFIX}/bin/ck2yaml
test -f ${CONDA_PREFIX}/share/cantera/data/gri30.yaml
test -d ${CONDA_PREFIX}/share/cantera/samples
test -d ${CONDA_PREFIX}/share/cantera/samples/python
test -d ${CONDA_PREFIX}/lib/python${{ env.PYTHON_VERSION }}/site-packages/cantera
- name: Test Essentials
# ensure that Python package loads and converter scripts work
Expand Down Expand Up @@ -428,6 +429,7 @@ jobs:
test -f ${CONDA_PREFIX}/Scripts/ck2yaml
test -f ${CONDA_PREFIX}/share/cantera/data/gri30.yaml
test -d ${CONDA_PREFIX}/share/cantera/samples
test -d ${CONDA_PREFIX}/share/cantera/samples/python
test -d ${CONDA_PREFIX}/Lib/site-packages/cantera
- name: Test Essentials
# ensure that Python package loads and converter scripts work
Expand Down
2 changes: 1 addition & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ def postInstallMessage(target, source, env):
))

if env["python_package"] == "full":
env["python_example_loc"] = pjoin(env["python_module_loc"], "cantera", "examples")
env["python_example_loc"] = pjoin(env["ct_sampledir"], "python")
install_message.append(locations_message.format(
name="Python package", location=env_dict["python_module_loc"]
))
Expand Down
2 changes: 1 addition & 1 deletion doc/example-keywords.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def get_all_keywords():
skip = set(text.splitlines())

all_keywords = Counter()
for d in (cantera_root / "interfaces/cython/cantera/examples").glob("**"):
for d in (cantera_root / "samples" / "python").glob("**"):
if d.is_dir():
for f in d.glob("*.py"):
if f.name.startswith("_") or f.name in skip:
Expand Down
3 changes: 3 additions & 0 deletions interfaces/cython/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ localenv = env.Clone()
dataFiles = localenv.RecursiveInstall("cantera/data", "#build/data")
build(dataFiles)

# Install Python samples
install(localenv.RecursiveInstall, "$inst_sampledir/python", "#samples/python")

# Get information needed to build the Python module
script = """\
from sysconfig import *
Expand Down
Empty file.
2 changes: 0 additions & 2 deletions interfaces/cython/setup.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ python_requires = >=@py_min_ver_str@
packages =
cantera
cantera.data
cantera.examples

[options.package_data]
cantera.data = *.*, */*.*
cantera.examples = */*.*
# The module extension needs to be here since we don't want setuptools to
# compile the extension, so there are no `source` files in
# the setup.py extension.
Expand Down
2 changes: 0 additions & 2 deletions interfaces/python_sdist/setup.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ python_requires = >=@py_min_ver_str@
packages =
cantera
cantera.data
cantera.examples

# These options include data in the sdist and wheel if the files are also listed in
# MANIFEST.in. Note that only files that are inside the "cantera" packages will be
# included in the wheel.
[options.package_data]
cantera.data = *.*, */*.*
cantera.examples = */*.*
cantera = *.pxd

# These options exclude data from the wheel file but not from the sdist
Expand Down
3 changes: 0 additions & 3 deletions samples/README.txt

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit b7f582b

Please sign in to comment.