easyblock = 'SCons'

name = 'Cantera'
version = '2.3.0'
versionsuffix = '-Python-%(pyver)s'

homepage = 'https://github.com/Cantera/cantera'
description = """Chemical kinetics, thermodynamics, and transport tool suite"""

toolchain = {'name': 'intel', 'version': '2016b'}
toolchainopts = {'strict': True}

source_urls = ['https://github.com/Cantera/cantera/archive/']
sources = ['v%(version)s.tar.gz']

patches = [
    'Cantera-%(version)s_fix-bug-416.patch',
    'Cantera-%(version)s_fix-test-reprod.patch',
]

dependencies = [
    ('Python', '2.7.12'),
    ('Boost', '1.63.0', versionsuffix),
    ('SUNDIALS', '2.7.0'),
]
builddependencies = [
    ('SCons', '2.5.1', versionsuffix),
    ('3to2', '1.1.1', versionsuffix),
    ('Eigen', '3.3.2'),
    ('fmt', '3.0.1'),
    ('googletest', '1.8.0'),
]

common_opts = 'env_vars=all CC="$CC" CXX="$CXX" blas_lapack_libs=mkl_rt blas_lapack_dir=$BLAS_LAPACK_LIB_DIR'
common_opts += ' sundials_include=$EBROOTSUNDIALS/include sundials_libdir=$EBROOTSUNDIALS/lib'
buildopts = 'build ' + common_opts
runtest = 'test ' + common_opts
installopts = 'install ' + common_opts
prefix_arg = 'prefix='

modextrapaths = {'PYTHONPATH': ['lib/python%(pyshortver)s/site-packages']}

sanity_check_paths = {
    'files': ['bin/mixmaster'],
    'dirs': ['include/cantera', 'lib/pkgconfig', 'lib/python%(pyshortver)s/site-packages'],
}

sanity_check_commands = [('python', "-c 'import cantera'")]

moduleclass = 'chem'
