2121# leave to None to install CDF library
2222# system will look for installed packed before installing a pysatCDF specific CDF install
2323base_cdf = None
24+ build_cdf_flag = True
2425
25- # leave items below to None unless base_cdf set to something other than None
26-
26+ # leave items below to None
2727# name of library, e.g. for mac os x, libcdf.a
2828lib_name = None
2929# shared library name, needed for some systems ( do not use Mac OS X)
3030shared_lib_name = None
31-
3231# CDF compile options
3332# note that the shared library name will be appended to extra_link_args automatically
3433extra_link_args = None
4241# some solutions in creating this file come from
4342# https://github.com/Turbo87/py-xcsoar/blob/master/setup.py
4443
45- # code to find if a CDF library is already installed in default locations
46-
47-
48- def find_CDF_base (lib_name ):
49- # try environment variables
50- cdf_base = os .getenv ('CDF_BASE' )
51- if cdf_base is not None :
52- # check
53- if os .path .exists (cdf_base ):
54- return cdf_base
55-
56- # that didn't work
57- # look in default locations
58- platform = sys .platform
59- user_dir = os .path .expanduser ('~' )
60- if platform == 'darwin' :
61- defaults = ['/Applications/' , user_dir ]
62- elif (platform == 'linux' ) | (platform == 'linux2' ):
63- defaults = ['/usr/local/' , user_dir ]
64- elif platform == 'win32' :
65- # Don't use NASA binaries on windows, not compatible
66- defaults = ['C:/CDF_Distribution/' ]
67- else :
68- raise ValueError ('Unknown platform, set CDF library in setup.py.' )
69-
70- # collect a list of posible directories to search in
71- # grab all dirs, select those that start with cdf
72- search_dir = []
73- for default in defaults :
74- sub_dirs = os .listdir (default )
75- for sub in sub_dirs :
76- # print(sub)
77- if sub [0 :3 ].lower () == 'cdf' :
78- search_dir .append (sub )
79- search_dir = np .sort (search_dir )
80- for test_dir in search_dir [::- 1 ]:
81- test_path = os .path .join (default , test_dir , 'lib' , lib_name )
82- if os .path .exists (test_path ):
83- return os .path .join (default , test_dir )
84-
85- raise ValueError ('Could not find CDF library, please set base directory in setup.py.' )
86-
87-
8844# get system parameters
8945platform = sys .platform
9046if platform == 'darwin' :
@@ -112,35 +68,12 @@ def find_CDF_base(lib_name):
11268 or (env_name is None ) or (extra_link_args is None ))):
11369 raise ValueError ('Unknown platform, please set setup.py parameters manually.' )
11470
115- # CDF directory hasn't been specified by user, see if an installation can be found
116- # Use of system CDF libraries disabled for compatibility reasons
117- # if base_cdf is None:
118- if False :
119- try :
120- base_cdf = find_CDF_base (lib_name )
121- print (' ' .join (('Found CDF installation at' , base_cdf )))
122- except ValueError :
123- print ('Unable to find CDF installation in default location.' )
124- base_cdf = None
125-
126- # Use of system CDF libraries disabled for compatibility reasons
127- # if base_cdf is None:
128- if True :
129- build_cdf_flag = True
130- # library not provided, build library included with pysatCDF
131- else :
132- build_cdf_flag = False
133- # raise NotImplementedError
134- if not os .path .isdir (base_cdf ):
135- raise ValueError ('CDF directory supplied is not an actual directory.' )
136- if (lib_name is None ):
137- raise ValueError ('Attempting to use pre-installed CDF library as directed.'
138- 'Please set setup.py parameters manually.' )
13971
14072
14173BASEPATH = os .path .dirname (os .path .abspath (__file__ ))
14274CDF_PATH = os .path .join (BASEPATH , 'cdf36_3-dist' )
14375
76+ # print (BASEPATH, CDF_PATH)
14477
14578class CDFBuild (build ):
14679 def run (self ):
@@ -159,7 +92,7 @@ def CDF_build(self, ppath):
15992 # print (' ')
16093 # print ("In CDF_build ", build_path, CDF_PATH, ppath)
16194 # print(' ')
162- # print (' ')
95+ # print(' ')
16396
16497 # check if library already exists
16598 if (not os .path .isfile (os .path .join (self .build_lib ,
@@ -178,7 +111,7 @@ def CDF_build(self, ppath):
178111 cmd2 = ['make' ,
179112 # 'INSTALLDIR='+build_path,
180113 'INSTALLDIR=' + build_path ,
181- 'install' , ]
114+ 'install' , '>/dev/null 2>&1' ]
182115
183116 # clean any previous attempts
184117 def compile0 ():
@@ -226,7 +159,7 @@ def run(self):
226159 lib_path = os .path .abspath (os .path .join (self .build_lib , 'pysatCDF' ))
227160 # set directories for the CDF library installed with pysatCDF
228161 self .extensions [0 ].include_dirs = [os .path .join (lib_path , 'include' )]
229- self .extensions [0 ].f2py_options = ['--include-paths' , os .path .join (lib_path , 'include' )]
162+ self .extensions [0 ].f2py_options = ['--include-paths' , os .path .join (lib_path , 'include' ), '--quiet' ]
230163 self .extensions [0 ].extra_objects = [os .path .join (lib_path , 'lib' , lib_name )]
231164 # add shared library, if provided
232165 if shared_lib_name is not None :
@@ -257,7 +190,7 @@ def run(self):
257190 name = 'pysatCDF.fortran_cdf' ,
258191 sources = [os .path .join ('pysatCDF' , 'fortran_cdf.f' )],
259192 include_dirs = [f2py_cdf_include_path ],
260- f2py_options = ['--include-paths' , f2py_cdf_include_path ], # '--Wall', 'n', '--Wno-tabs', 'n'],
193+ f2py_options = ['--quiet' , '-- include-paths' , f2py_cdf_include_path ], # '--Wall', 'n', '--Wno-tabs', 'n'],
261194 extra_objects = [f2py_cdf_lib_path ],
262195 extra_link_args = extra_link_args )
263196
@@ -288,7 +221,7 @@ def run(self):
288221 # 3 - Alpha
289222 # 4 - Beta
290223 # 5 - Production/Stable
291- 'Development Status :: 3 - Alpha ' ,
224+ 'Development Status :: 4 - Beta ' ,
292225
293226 # Indicate who your project is intended for
294227 'Intended Audience :: Science/Research' ,
0 commit comments