eccodes/python/setup.py.in

74 lines
2.7 KiB
Python
Raw Normal View History

2013-03-25 12:04:10 +00:00
#!/usr/bin/env python
from distutils.core import setup, Extension
2016-07-13 16:34:38 +00:00
import os
import sys
2013-03-25 12:04:10 +00:00
import numpy
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = numpy.get_include()
except AttributeError:
numpy_include = numpy.get_numpy_include()
2013-03-25 12:04:10 +00:00
attdict = dict(sources=['@CMAKE_CURRENT_SOURCE_DIR@/swig_wrap_numpy.c',
2016-07-13 16:34:38 +00:00
'@CMAKE_CURRENT_SOURCE_DIR@/grib_interface.c'],
swig_opts=[],
include_dirs=['.', '@CMAKE_CURRENT_BINARY_DIR@/../src',
'@CMAKE_CURRENT_SOURCE_DIR@/../src',
numpy_include],
2016-07-13 16:34:38 +00:00
library_dirs=['@CMAKE_BINARY_DIR@/lib'],
libraries=['eccodes'],
extra_objects=[],
extra_link_args=['-Wl,-rpath,@CMAKE_INSTALL_PREFIX@/lib'])
2013-03-25 12:04:10 +00:00
2016-07-13 16:34:38 +00:00
add_attribute = lambda **args: [list.append(attdict[key], value)
for key, value in args.items()]
2013-03-25 12:04:10 +00:00
with_jasper = @HAVE_LIBJASPER@
2013-03-25 12:04:10 +00:00
if with_jasper:
jasper_dir = '@JASPER_DIR@'
if jasper_dir and jasper_dir != 'system':
2016-07-13 16:34:38 +00:00
add_attribute(include_dirs=os.path.join(jasper_dir, 'include'),
library_dirs=os.path.join(jasper_dir, 'lib'),
extra_link_args='-Wl,-rpath,' + os.path.join(jasper_dir, 'lib'))
add_attribute(libraries='jasper')
2013-03-25 12:04:10 +00:00
#with_openjpeg = @HAVE_LIBOPENJPEG@
#if with_openjpeg:
# openjpeg_dir = '@OPENJPEG_DIR@'
# if openjpeg_dir and openjpeg_dir != 'system':
# add_attribute(include_dirs=os.path.join(openjpeg_dir, 'include'),
# library_dirs=os.path.join(openjpeg_dir, 'lib'),
# extra_link_args='-Wl,-rpath,' + os.path.join(openjpeg_dir, 'lib'))
# add_attribute(libraries='openjpeg')
#
2013-03-25 12:04:10 +00:00
# assumes png is supplied by system paths -- may not be true
2016-07-13 16:43:27 +00:00
png = @HAVE_LIBPNG@
2013-03-25 12:04:10 +00:00
if png:
2016-07-13 16:34:38 +00:00
add_attribute(libraries='png')
with_aec = @HAVE_AEC@
if with_aec:
aec_dir = '@AEC_DIR@'
if aec_dir and aec_dir != 'system':
2016-07-13 16:34:38 +00:00
add_attribute(include_dirs=os.path.join(aec_dir, 'include'),
library_dirs=os.path.join(aec_dir, 'lib'),
extra_link_args='-Wl,-rpath,' + os.path.join(aec_dir, 'lib'))
add_attribute(libraries='aec')
2013-03-25 12:04:10 +00:00
2016-07-13 16:34:38 +00:00
setup(name='eccodes',
version='@ECCODES_VERSION_STR@',
author='ECMWF',
2016-07-18 16:06:07 +00:00
author_email='Software.Support@ecmwf.int',
description="""Python interface for ecCodes""",
license='Apache License, Version 2.0',
url='https://software.ecmwf.int/wiki/display/ECC/ecCodes+Home',
download_url='https://software.ecmwf.int/wiki/display/ECC/Releases',
2016-07-13 16:34:38 +00:00
ext_modules=[Extension('gribapi._gribapi_swig', **attdict)],
packages=['eccodes', 'gribapi'])