# IT4Innovations 2019

easyblock = 'CMakeMake'

name = 'Arrow'
version = '0.15.0'
versionsuffix = '-Py-3.6'

homepage = 'https://arrow.apache.org'
description = "Apache Arrow (incl. PyArrow Python bindings)), a cross-language development platform for in-memory data."

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

source_urls = [
    'http://apache.belnet.be/arrow/arrow-%(version)s/',
    'https://www-eu.apache.org/dist/arrow/arrow-%(version)s/',
]
sources = ['apache-arrow-%(version)s.tar.gz']

builddependencies = [
    ('CMake', '3.14.1', '', True),
    ('Autotools', '20180311', '', True),
    ('flex', '2.6.4', '', True),
    ('Bison', '3.3.2', '', True),
    ('pkg-config', '0.29.2', '', True),
]

# Arrow strongly prefers included jemalloc, so not including it as a dependency
dependencies = [
    ('Py', '3.6', '', True),
    ('Boost', '1.70.0', '-Py-3.6'),
    ('numpy', '1.16.3', '-Py-3.6', True),
]

separate_build_dir = True
start_dir = 'cpp'

# see https://arrow.apache.org/docs/python/development.html
configopts = "-DCMAKE_BUILD_TYPE=Release -DARROW_PYTHON=on -DCMAKE_INSTALL_LIBDIR=lib"

# also install Python bindings
local_install_pyarrow_cmds = "export PKG_CONFIG_PATH=%(installdir)s/lib/pkgconfig:$PKG_CONFIG_PATH && "
local_install_pyarrow_cmds += "export PYTHONPATH=%(installdir)s/lib/python3.6/site-packages:$PYTHONPATH && "
local_install_pyarrow_cmds += " cd %(builddir)s/*arrow-%(version)s/python && "
local_install_pyarrow_cmds += " export XDG_CACHE_HOME=$TMPDIR && pip install --prefix %(installdir)s ."
#postinstallcmds = [local_install_pyarrow_cmds]

modextrapaths = {'PYTHONPATH': 'lib/python3.6/site-packages'}

sanity_check_paths = {
    'files': ['lib/libarrow.a', 'lib/libarrow.%s' % SHLIB_EXT,
              'lib/libarrow_python.a', 'lib/libarrow_python.%s' % SHLIB_EXT],
    'dirs': ['include/arrow', 'lib/cmake/arrow', 'lib/pkgconfig'],
}

moduleclass = 'data'
