Skip to content

Commit

Permalink
Prevent installation of cantera from PyPI (#33)
Browse files Browse the repository at this point in the history
* Prevent installation of cantera from PyPI

* Disable MKL

MKL is disabled as a temporary fix of #29 to resolve #31. It should be
reactivated in a permanent fix.

* Add yaml2ck script

* Update pytest

Starting with Cantera 3.0, the Python test suite is no longer packaged
with the Python module. This commit ensures that conda is still able
to run the tests.

* Replace deprecated SCons option

* Include share/cantera/data in libcantera
  • Loading branch information
ischoegl authored Aug 10, 2022
1 parent 81fdfec commit 68448f7
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 19 deletions.
1 change: 1 addition & 0 deletions .ci_support/cantera_base.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ system_sundials = 'n'
debug = 'n'
python_package = 'none'
googletest = 'none'
layout = 'conda'
4 changes: 2 additions & 2 deletions cantera-matlab/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ echo "stage_dir = '${STAGE_DIR}'" >> cantera.conf
if [[ "${OSX_ARCH}" == "" ]]; then
echo "optimize_flags = ''" >> cantera.conf
echo "debug = False" >> cantera.conf
echo "VERBOSE = True" >> cantera.conf
echo "logging = 'debug'" >> cantera.conf
else
echo "cc_flags = '-isysroot ${CONDA_BUILD_SYSROOT}'" >> cantera.conf
echo "optimize_flags = ''" >> cantera.conf
echo "debug = False" >> cantera.conf
echo "no_debug_linker_flags = '-isysroot ${CONDA_BUILD_SYSROOT}'" >> cantera.conf
echo "use_rpath_linkage = False" >> cantera.conf
echo "VERBOSE = True" >> cantera.conf
echo "logging = 'debug'" >> cantera.conf
fi

echo "matlab_toolbox = 'y'" >> cantera.conf
Expand Down
7 changes: 4 additions & 3 deletions cantera/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ echo "boost_inc_dir = '${PREFIX}/include'" >> cantera.conf
if [[ "${OSX_ARCH}" == "" ]]; then
echo "CC = '${CC}'" >> cantera.conf
echo "CXX = '${CXX}'" >> cantera.conf
echo "blas_lapack_libs = 'mkl_rt,dl'" >> cantera.conf
# TODO: reactivate MKL; it is disabled as a temporary fix of #29 to resolve #31
# echo "blas_lapack_libs = 'mkl_rt,dl'" >> cantera.conf
echo "blas_lapack_dir = '${PREFIX}/lib'" >> cantera.conf
echo "cc_flags = '${CFLAGS}'" >> cantera.conf
echo "cxx_flags = '${CPPFLAGS}'" >> cantera.conf
Expand All @@ -20,7 +21,7 @@ if [[ "${OSX_ARCH}" == "" ]]; then
echo "use_rpath_linkage = False" >> cantera.conf
echo "no_debug_linker_flags = '${LDFLAGS}'" >> cantera.conf
echo "renamed_shared_libraries = False" >> cantera.conf
echo "VERBOSE = True" >> cantera.conf
echo "logging = 'debug'" >> cantera.conf
else
echo "CC = '${CLANG}'" >> cantera.conf
echo "CXX = '${CLANGXX}'" >> cantera.conf
Expand All @@ -31,7 +32,7 @@ else
echo "optimize_flags = ''" >> cantera.conf
echo "debug = False" >> cantera.conf
echo "no_debug_linker_flags = '${LDFLAGS} -isysroot ${CONDA_BUILD_SYSROOT}'" >> cantera.conf
echo "VERBOSE = True" >> cantera.conf
echo "logging = 'debug'" >> cantera.conf
echo "renamed_shared_libraries = False" >> cantera.conf
echo "use_rpath_linkage = False" >> cantera.conf
fi
Expand Down
5 changes: 4 additions & 1 deletion cantera/build_lib.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
call %RECIPE_DIR%/build_devel.bat
echo "****************************"
echo "DELETING files from devel except shared libraries"
echo "DELETING files from devel except shared libraries and data"
echo "****************************"

rd /s /q %PREFIX%\Library\share\cantera\doc
rd /s /q %PREFIX%\Library\share\cantera\samples
rd /s /q %PREFIX%\Library\share\man
rd /s /q %PREFIX%\Library\share
rd /s /q %PREFIX%\Library\include\cantera
6 changes: 4 additions & 2 deletions cantera/build_lib.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
source $RECIPE_DIR/build_devel.sh
echo "****************************"
echo "DELETING files from devel except shared libraries"
echo "DELETING files from devel except shared libraries and data"
echo "****************************"

rm -rf $PREFIX/share
rm -rf $PREFIX/share/cantera/doc
rm -rf $PREFIX/share/cantera/samples
rm -rf $PREFIX/share/man
rm -rf $PREFIX/include/cantera
rm -rf $PREFIX/bin
rm -rf $PREFIX/lib/pkg-config
Expand Down
2 changes: 1 addition & 1 deletion cantera/build_py.bat
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ echo ****************************
echo PYTHON %PYTHON% BUILD COMPLETED SUCCESSFULLY
echo ****************************

"%PYTHON%" -m pip install --no-deps --find-links=build\python\dist\ cantera
"%PYTHON%" -m pip install --no-deps --no-index --find-links=build\python\dist\ cantera
IF ERRORLEVEL 1 EXIT 1
3 changes: 2 additions & 1 deletion cantera/build_py.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ if [ -d "build/python" ]; then
rm $PREFIX/bin/ck2yaml || true
rm $PREFIX/bin/cti2yaml || true
rm $PREFIX/bin/ctml2yaml || true
rm $PREFIX/bin/yaml2ck || true
fi

${BUILD_PREFIX}/bin/python `which scons` build python_package='y' python_cmd="${PYTHON}"

$PYTHON -m pip install --no-deps --find-links=build/python/dist cantera
$PYTHON -m pip install --no-deps --no-index --find-links=build/python/dist cantera

if [[ "$target_platform" == osx-* ]]; then
VERSION=$(echo $PKG_VERSION | cut -da -f1 | cut -db -f1 | cut -dr -f1)
Expand Down
22 changes: 13 additions & 9 deletions cantera/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ requirements:
host:
- libboost
- openblas # [osx]
- mkl # [linux]
# - mkl # [linux] # TODO: reactivate MKL in permanent fix of #29
- pywin32 # [win]

build:
Expand All @@ -43,9 +43,9 @@ outputs:
- libboost
- pywin32 # [win]
- openblas # [osx]
- mkl # [linux]
# - mkl # [linux] # TODO: reactivate MKL in permanent fix of #29
run:
- mkl # [linux]
# - mkl # [linux] # TODO: reactivate MKL in permanent fix of #29
- openblas # [osx]
test:
commands:
Expand All @@ -67,7 +67,7 @@ outputs:
host:
- libboost
- openblas # [osx]
- mkl # [linux]
# - mkl # [linux] # TODO: reactivate MKL in permanent fix of #29
- pywin32 # [win]
- libcantera {{ version }}
run:
Expand All @@ -88,7 +88,7 @@ outputs:
- libboost
- numpy
- openblas # [osx]
- mkl # [linux]
# - mkl # [linux] # TODO: reactivate MKL in permanent fix of #29
- cython
- pywin32 # [win]
# This is added here so conda-build doesn't package it
Expand All @@ -102,12 +102,13 @@ outputs:
- ruamel.yaml
- {{ pin_subpackage('libcantera', exact=True) }}
- openblas # [osx]
- mkl # [linux]
# - mkl # [linux] # TODO: reactivate MKL in permanent fix of #29
build:
entry_points:
- ck2yaml = cantera.ck2yaml:script_entry_point
- cti2yaml = cantera.cti2yaml:main
- ctml2yaml = cantera.ctml2yaml:main
- yaml2ck = cantera.yaml2ck:main
include_recipe: True
ignore_run_exports_from:
# only the header part of these libraries are used
Expand All @@ -118,13 +119,16 @@ outputs:
- pytest
imports:
- cantera
source_files:
- test/python
- test/data
- data
commands:
# The version of pytest available from the default channel does not support
# Python 3.10
- pytest -vv --pyargs cantera.test # [not py==310]
- pytest -vv test/python
- cti2yaml --help
- ck2yaml --help
- ctml2yaml --help
- yaml2ck --help

about:
home: https://cantera.org
Expand Down

0 comments on commit 68448f7

Please sign in to comment.