From 5cf3fc057ebfba74ca41482120dd6be718d9035d Mon Sep 17 00:00:00 2001 From: rstoneback Date: Mon, 6 Aug 2018 15:27:25 -0500 Subject: [PATCH 1/3] Tweaked setup --- setup.py | 83 ++++++-------------------------------------------------- 1 file changed, 8 insertions(+), 75 deletions(-) diff --git a/setup.py b/setup.py index 246dc09..9d95190 100644 --- a/setup.py +++ b/setup.py @@ -21,14 +21,13 @@ # leave to None to install CDF library # system will look for installed packed before installing a pysatCDF specific CDF install base_cdf = None +build_cdf_flag = True -# leave items below to None unless base_cdf set to something other than None - +# leave items below to None # name of library, e.g. for mac os x, libcdf.a lib_name = None # shared library name, needed for some systems ( do not use Mac OS X) shared_lib_name = None - # CDF compile options # note that the shared library name will be appended to extra_link_args automatically extra_link_args = None @@ -42,49 +41,6 @@ # some solutions in creating this file come from # https://github.com/Turbo87/py-xcsoar/blob/master/setup.py -# code to find if a CDF library is already installed in default locations - - -def find_CDF_base(lib_name): - # try environment variables - cdf_base = os.getenv('CDF_BASE') - if cdf_base is not None: - # check - if os.path.exists(cdf_base): - return cdf_base - - # that didn't work - # look in default locations - platform = sys.platform - user_dir = os.path.expanduser('~') - if platform == 'darwin': - defaults = ['/Applications/', user_dir] - elif (platform == 'linux') | (platform == 'linux2'): - defaults = ['/usr/local/', user_dir] - elif platform == 'win32': - # Don't use NASA binaries on windows, not compatible - defaults = ['C:/CDF_Distribution/'] - else: - raise ValueError('Unknown platform, set CDF library in setup.py.') - - # collect a list of posible directories to search in - # grab all dirs, select those that start with cdf - search_dir = [] - for default in defaults: - sub_dirs = os.listdir(default) - for sub in sub_dirs: - # print(sub) - if sub[0:3].lower() == 'cdf': - search_dir.append(sub) - search_dir = np.sort(search_dir) - for test_dir in search_dir[::-1]: - test_path = os.path.join(default, test_dir, 'lib', lib_name) - if os.path.exists(test_path): - return os.path.join(default, test_dir) - - raise ValueError('Could not find CDF library, please set base directory in setup.py.') - - # get system parameters platform = sys.platform if platform == 'darwin': @@ -112,35 +68,12 @@ def find_CDF_base(lib_name): or (env_name is None) or (extra_link_args is None))): raise ValueError('Unknown platform, please set setup.py parameters manually.') -# CDF directory hasn't been specified by user, see if an installation can be found -# Use of system CDF libraries disabled for compatibility reasons -# if base_cdf is None: -if False: - try: - base_cdf = find_CDF_base(lib_name) - print(' '.join(('Found CDF installation at', base_cdf))) - except ValueError: - print('Unable to find CDF installation in default location.') - base_cdf = None - -# Use of system CDF libraries disabled for compatibility reasons -# if base_cdf is None: -if True: - build_cdf_flag = True - # library not provided, build library included with pysatCDF -else: - build_cdf_flag = False - # raise NotImplementedError - if not os.path.isdir(base_cdf): - raise ValueError('CDF directory supplied is not an actual directory.') - if (lib_name is None): - raise ValueError('Attempting to use pre-installed CDF library as directed.' - 'Please set setup.py parameters manually.') BASEPATH = os.path.dirname(os.path.abspath(__file__)) CDF_PATH = os.path.join(BASEPATH, 'cdf36_3-dist') +# print (BASEPATH, CDF_PATH) class CDFBuild(build): def run(self): @@ -159,7 +92,7 @@ def CDF_build(self, ppath): # print (' ') # print ("In CDF_build ", build_path, CDF_PATH, ppath) # print(' ') - # print (' ') + # print(' ') # check if library already exists if (not os.path.isfile(os.path.join(self.build_lib, @@ -178,7 +111,7 @@ def CDF_build(self, ppath): cmd2 = ['make', # 'INSTALLDIR='+build_path, 'INSTALLDIR=' + build_path, - 'install', ] + 'install', '>/dev/null 2>&1'] # clean any previous attempts def compile0(): @@ -226,7 +159,7 @@ def run(self): lib_path = os.path.abspath(os.path.join(self.build_lib, 'pysatCDF')) # set directories for the CDF library installed with pysatCDF self.extensions[0].include_dirs = [os.path.join(lib_path, 'include')] - self.extensions[0].f2py_options = ['--include-paths', os.path.join(lib_path, 'include')] + self.extensions[0].f2py_options = ['--include-paths', os.path.join(lib_path, 'include'), '--quiet'] self.extensions[0].extra_objects = [os.path.join(lib_path, 'lib', lib_name)] # add shared library, if provided if shared_lib_name is not None: @@ -257,7 +190,7 @@ def run(self): name='pysatCDF.fortran_cdf', sources=[os.path.join('pysatCDF', 'fortran_cdf.f')], include_dirs=[f2py_cdf_include_path], - f2py_options=['--include-paths', f2py_cdf_include_path], # '--Wall', 'n', '--Wno-tabs', 'n'], + f2py_options=['--quiet', '--include-paths', f2py_cdf_include_path], # '--Wall', 'n', '--Wno-tabs', 'n'], extra_objects=[f2py_cdf_lib_path], extra_link_args=extra_link_args) @@ -288,7 +221,7 @@ def run(self): # 3 - Alpha # 4 - Beta # 5 - Production/Stable - 'Development Status :: 3 - Alpha', + 'Development Status :: 4 - Beta', # Indicate who your project is intended for 'Intended Audience :: Science/Research', From 2740b6aaa5ec4f7d0a0fc097a9c7c79b94a8dac8 Mon Sep 17 00:00:00 2001 From: Russell Stoneback Date: Mon, 2 Dec 2019 10:16:40 -0600 Subject: [PATCH 2/3] Update .travis.yml --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 960fa26..420be9b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,7 +29,7 @@ before_install: - conda info -a # Replace dep1 dep2 ... with your dependencies - - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION atlas numpy scipy matplotlib nose pandas statsmodels coverage + - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION numpy scipy matplotlib nose pandas statsmodels coverage # command to install dependencies install: @@ -39,6 +39,7 @@ install: - pip install coveralls - pip install pysat - "python setup.py develop" + - pip install netCDF4 # command to run tests script: #- nosetests From 72e66334bda64aaadf425124f8e20ae8796104f5 Mon Sep 17 00:00:00 2001 From: Russell Stoneback Date: Mon, 2 Dec 2019 11:08:23 -0600 Subject: [PATCH 3/3] Update README.md Updated badges for new repo location --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2449d1d..219259d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # pysatCDF -[![Build Status](https://travis-ci.org/rstoneback/pysatCDF.svg?branch=master)](https://travis-ci.org/rstoneback/pysatCDF) -[![Coverage Status](https://coveralls.io/repos/github/rstoneback/pysatCDF/badge.svg?branch=master)](https://coveralls.io/github/rstoneback/pysatCDF?branch=master) +[![Build Status](https://travis-ci.org/pysat/pysatCDF.svg?branch=master)](https://travis-ci.org/pysat/pysatCDF) +[![Coverage Status](https://coveralls.io/repos/github/pysat/pysatCDF/badge.svg?branch=master)](https://coveralls.io/github/pysat/pysatCDF?branch=master) [![DOI](https://zenodo.org/badge/51764432.svg)](https://zenodo.org/badge/latestdoi/51764432) Self-contained Python reader for NASA CDF file format