mirror of https://github.com/ecmwf/eccodes.git
ECC-296 Clean up setup.py
This commit is contained in:
parent
58affc60a8
commit
cad2ea0b4a
|
@ -1,66 +1,54 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
from distutils.core import setup, Extension
|
||||
import os,sys
|
||||
import os
|
||||
import sys
|
||||
|
||||
attdict = dict(
|
||||
sources = ['@CMAKE_CURRENT_SOURCE_DIR@/@_swig_c_wrapper@',
|
||||
'@CMAKE_CURRENT_SOURCE_DIR@/grib_interface.c'],
|
||||
swig_opts = [],
|
||||
include_dirs = ['.', '@CMAKE_CURRENT_BINARY_DIR@/../src', '@CMAKE_CURRENT_SOURCE_DIR@/../src'],
|
||||
library_dirs = ['@CMAKE_BINARY_DIR@/lib'],
|
||||
libraries = ['eccodes'],
|
||||
extra_objects = [],
|
||||
extra_link_args = ['-Wl,-rpath,@CMAKE_INSTALL_PREFIX@/lib']
|
||||
)
|
||||
attdict = dict(sources=['@CMAKE_CURRENT_SOURCE_DIR@/@_swig_c_wrapper@',
|
||||
'@CMAKE_CURRENT_SOURCE_DIR@/grib_interface.c'],
|
||||
swig_opts=[],
|
||||
include_dirs=['.', '@CMAKE_CURRENT_BINARY_DIR@/../src',
|
||||
'@CMAKE_CURRENT_SOURCE_DIR@/../src'],
|
||||
library_dirs=['@CMAKE_BINARY_DIR@/lib'],
|
||||
libraries=['eccodes'],
|
||||
extra_objects=[],
|
||||
extra_link_args=['-Wl,-rpath,@CMAKE_INSTALL_PREFIX@/lib'])
|
||||
|
||||
add_attribute = lambda **args: [list.append(attdict[key],value) for key,value in args.items()]
|
||||
|
||||
# assumes build_dir is same as source_dir -- not true for cmake builds
|
||||
#build_dir = '@BUILD_DIR@'
|
||||
#add_attribute(
|
||||
# include_dirs = os.path.join(build_dir,'src'),
|
||||
# extra_objects = os.path.join(build_dir, 'src', '.libs', 'libeccodes.a')
|
||||
#)
|
||||
add_attribute = lambda **args: [list.append(attdict[key], value)
|
||||
for key, value in args.items()]
|
||||
|
||||
with_jasper = @HAVE_LIBJASPER@
|
||||
if with_jasper:
|
||||
jasper_dir = '@JASPER_DIR@'
|
||||
if jasper_dir and jasper_dir != 'system':
|
||||
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')
|
||||
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')
|
||||
|
||||
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')
|
||||
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')
|
||||
|
||||
# assumes png is supplied by system paths -- may not be true
|
||||
png = @HAVE_PNG@
|
||||
if png:
|
||||
add_attribute(libraries = 'png')
|
||||
add_attribute(libraries='png')
|
||||
|
||||
|
||||
with_aec = @HAVE_AEC@
|
||||
if with_aec:
|
||||
aec_dir = '@AEC_DIR@'
|
||||
if aec_dir and aec_dir != 'system':
|
||||
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')
|
||||
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')
|
||||
|
||||
|
||||
data_handler = '@DATA_HANDLER@'
|
||||
|
@ -72,15 +60,11 @@ if data_handler == "numpy":
|
|||
except AttributeError:
|
||||
numpy_include = numpy.get_numpy_include()
|
||||
|
||||
add_attribute(
|
||||
include_dirs = numpy_include,
|
||||
)
|
||||
#gribapi_module = Extension('_gribapi_swig',**attdict)
|
||||
add_attribute(include_dirs=numpy_include)
|
||||
|
||||
setup (name = 'eccodes',
|
||||
version = '@ECCODES_VERSION_STR@',
|
||||
author = 'ECMWF',
|
||||
description = """Python interface for eccodes and grib_api""",
|
||||
ext_modules = [Extension('gribapi._gribapi_swig',**attdict)],
|
||||
packages = ['eccodes','gribapi'],
|
||||
)
|
||||
setup(name='eccodes',
|
||||
version='@ECCODES_VERSION_STR@',
|
||||
author='ECMWF',
|
||||
description="""Python interface for eccodes and grib_api""",
|
||||
ext_modules=[Extension('gribapi._gribapi_swig', **attdict)],
|
||||
packages=['eccodes', 'gribapi'])
|
||||
|
|
Loading…
Reference in New Issue