easyblock = 'PythonPackage'

name = 'mpi4py'
version = '2.0.0'
label = 'timed-pingpong'
versionsuffix = '-Python-%%(pyver)s-%s' % label

homepage = 'https://bitbucket.org/mpi4py/mpi4py'
description = """MPI for Python (mpi4py) provides bindings of the Message Passing Interface (MPI) standard for
 the Python programming language, allowing any Python program to exploit multiple processors."""

toolchain = {'name': 'intel', 'version': '2017a'}

source_urls = [PYPI_SOURCE]
sources = [SOURCE_TAR_GZ]
patches = ['mpi4py-1.3.1_%s.patch' % label]
checksums = [
    '6543a05851a7aa1e6d165e673d422ba24e45c41e4221f0993fe1e5924a00cb81',  # mpi4py-2.0.0.tar.gz
    '50c3c4032563afda15ab51a5002c4646da361a006398e74d16ee0d433dd92792',  # mpi4py-1.3.1_timed-pingpong.patch
]

dependencies = [('Python', '2.7.13')]

# force rebuilding everything, including patched files
buildopts = '--force'

sanity_check_paths = {
    'files': [],
    'dirs': ['lib/python%(pyshortver)s/site-packages/mpi4py'],
}

# check that timed pingpong routines that are added via the patch are available
sanity_check_commands = [
    ('python', '-c "from mpi4py.MPI import Comm; import sys; sys.exit((1, 0)[\'PingpongRS\' in dir(Comm)])"'),
]

moduleclass = 'lib'
