1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
from __future__ import print_function
import numpy
import os
from setuptools import setup, Extension
include_dirs = [numpy.get_include(),"include","include/cdTime"]
library_dirs = [ os.path.join("@prefix@","lib") ,'.']
include_dirs.append(os.path.join("@prefix@","include"))
libraries = []
link_args = []
for st in ["@NCLDFLAGS@", "@NCCFLAGS@",
"@UDUNITS2FLAGS@", "@UDUNITS2LDFLAGS@",
"@JSONCFLAGS@", "@JSONCLDFLAGS@",
"@UUIDFLAGS@", "@UUIDLDFLAGS@"]:
sp = st.strip().split()
for s in sp:
if s[:2]=='-L':
library_dirs.append(s[2:])
if s[:2]=='-l':
libraries.append(s[2:])
if s[:2]=='-I':
include_dirs.append(s[2:])
if s[:4]=='-Wl,':
link_args.append(s)
srcfiles = "@LIBSOURCES@".split()
macros=[]
for m in "@MACROS@".split():
macros.append((m[2:],None))
ld =[]
for p in library_dirs:
if os.path.exists(p):
ld.append(p)
library_dirs=ld
ld =[]
for p in include_dirs:
if os.path.exists(p):
ld.append(p)
include_dirs=ld
print('Setting up python module with:')
print('libraries:',libraries)
print('libdir:',library_dirs)
print('incdir',include_dirs)
print('src:',srcfiles)
print('macros:',macros)
setup (name = "CMOR",
version='3.13.2',
author='Chris Mauzey, LLNL',
description = "Python Interface to CMOR output library",
url = "https://cmor.llnl.gov/",
zip_safe=False,
packages = ['cmor', 'cmor.Test'],
package_dir = {'cmor': 'Lib', 'cmor.Test':'Test'},
# scripts=['scripts/PrePARE.py' ],
ext_modules = [
Extension('cmor._cmor',
srcfiles,
include_dirs = include_dirs,
library_dirs = library_dirs,
libraries = libraries,
define_macros = macros,
extra_compile_args = [ "-DgFortran"],
extra_link_args = link_args
),
]
)
|