from setuptools import setup, Extension import os, sys import subprocess as sp here = os.path.abspath(os.path.dirname(__file__)) # README = open(os.path.join(here, 'README.rst')).read() # NEWS = open(os.path.join(here, 'NEWS.txt')).read() install_requires = [ 'cffi', 'netcdf4' ] SYS_LIBRARIES = { # 'linux': ['boost_system'], } def libraries_for_platform(): env = os.environ.get('LIBS', None) if env is not None: import re return list(re.split(r'[,\s]+', env)) zult = SYS_LIBRARIES.get(sys.platform, []) return zult SRCS = "HCastFile.cxx HimawariHSDFile.cxx aHimawariFile.cxx HimawariScene.cxx erfa/erfa.c HimawariResample.cxx" SOURCES = ['src/' + x for x in SRCS.split()] INCLUDES = [os.path.abspath(x) for x in ['include', 'src/erfa']] # build a stub module which we actually use CFFI to access in bit_untrim.py _himawari = Extension('_himawari', sources = ['src/py_himawari_stub.c'] + SOURCES, include_dirs=INCLUDES, libraries=libraries_for_platform(), extra_compile_args=["-DNO_LRU_CACHE"] ) def _git_version(): try: return sp.check_output(['git', 'rev-parse', 'HEAD']).encode('ASCII').strip()[:8] except: # want to use sp.CalledProcessError but under Windows it shows up as WindowsError. because, windows... from datetime import datetime when = datetime.utcnow().strftime("%Y%m%dT%H%M%S") print("WARNING: using current time as version instead of GIT hash") return when setup(name='himawari', version=_git_version(), description="Access library for Himawari AHI HSD format files", # long_description=README + '\n\n' + NEWS, classifiers=[ # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers ], keywords='Himawari-8 Himawari-9 AHI HSD', author='R.K.Garcia', author_email='rayg@ssec.wisc.edu', url='http://www.ssec.wisc.edu', license='GPLv3', packages=['himawari'], # package_dir = {'himawari': 'py'}, # include_package_data=True, # package_data={'himawari': ['data/TD/leapsec.dat']}, zip_safe=False, install_requires=install_requires, extras_require = { 'scmi': ['goesr'], # https://gitlab.ssec.wisc.edu/rayg/goesr }, ext_modules = [_himawari], # entry_points={ # 'console_scripts': # ['sips_cris_l0l1a=sips_cris_l0l1a:main', # 'cris_l1a_lint=sips_cris_l0l1a.lint:main', # 'flagpoll=sips_cris_l0l1a.flagpoll:main', # 'nc_compare_schema=sips_cris_l0l1a.netcdf_compare:main', # 'nc_copy_vars=sips_cris_l0l1a.netcdf:main', # 'nc_copy_schema=sips_cris_l0l1a.netcdf_copy_vars:main'] # } )