|
| 1 | +#!/usr/bin/env python |
| 2 | + |
| 3 | +""" |
| 4 | +setup.py file for GridDB python client |
| 5 | +""" |
| 6 | + |
| 7 | +from distutils.command.build import build |
| 8 | + |
| 9 | +try: |
| 10 | + from setuptools import setup, Extension |
| 11 | +except ImportError: |
| 12 | + from distutils.core import setup, Extension |
| 13 | + |
| 14 | +try: |
| 15 | + with open('README.rst') as f: |
| 16 | + readme = f.read() |
| 17 | +except IOError: |
| 18 | + readme = '' |
| 19 | + |
| 20 | +SOURCES = [ |
| 21 | + 'src/AggregationResult.cpp', |
| 22 | + 'src/Container.cpp', |
| 23 | + 'src/ContainerInfo.cpp', |
| 24 | + 'src/Field.cpp', |
| 25 | + 'src/PartitionController.cpp', |
| 26 | + 'src/Query.cpp', |
| 27 | + 'src/QueryAnalysisEntry.cpp', |
| 28 | + 'src/RowKeyPredicate.cpp', |
| 29 | + 'src/RowSet.cpp', |
| 30 | + 'src/Store.cpp', |
| 31 | + 'src/StoreFactory.cpp', |
| 32 | + 'src/TimeSeriesProperties.cpp', |
| 33 | + 'src/TimestampUtils.cpp', |
| 34 | + 'src/griddb.i', |
| 35 | + 'src/Util.cpp', |
| 36 | +] |
| 37 | + |
| 38 | +DEPENDENTS = [ |
| 39 | + 'src/AggregationResult.h', |
| 40 | + 'src/ContainerInfo.h', |
| 41 | + 'src/Container.h', |
| 42 | + 'src/ExpirationInfo.h', |
| 43 | + 'src/Field.h' |
| 44 | + 'src/GSException.h', |
| 45 | + 'src/PartitionController.h', |
| 46 | + 'src/Query.h', |
| 47 | + 'src/QueryAnalysisEntry.h', |
| 48 | + 'src/RowKeyPredicate.h', |
| 49 | + 'src/RowSet.h', |
| 50 | + 'src/Store.h', |
| 51 | + 'src/StoreFactory.h', |
| 52 | + 'src/TimeSeriesProperties.h', |
| 53 | + 'src/TimestampUtils.h', |
| 54 | + 'src/gstype_python.i', |
| 55 | + 'src/gstype.i', |
| 56 | + 'include/gridstore.h', |
| 57 | + 'include/Util.h', |
| 58 | +] |
| 59 | + |
| 60 | +INCLUDES = [ |
| 61 | + 'include', |
| 62 | + 'src', |
| 63 | +] |
| 64 | + |
| 65 | +COMPILE_ARGS = [ |
| 66 | + '-std=c++0x' |
| 67 | +] |
| 68 | + |
| 69 | +LIBRARIES = [ |
| 70 | + 'rt', |
| 71 | + 'gridstore', |
| 72 | +] |
| 73 | + |
| 74 | +SWIG_OPTS = [ |
| 75 | + '-DSWIGWORDSIZE64', |
| 76 | + '-c++', |
| 77 | + '-outdir', |
| 78 | + '.', |
| 79 | + '-Isrc' |
| 80 | +] |
| 81 | + |
| 82 | + |
| 83 | +class CustomBuild(build): |
| 84 | + sub_commands = [ |
| 85 | + ('build_ext', build.has_ext_modules), |
| 86 | + ('build_py', build.has_pure_modules), |
| 87 | + ('build_clib', build.has_c_libraries), |
| 88 | + ('build_scripts', build.has_scripts), |
| 89 | + ] |
| 90 | + |
| 91 | + |
| 92 | +griddb_module = Extension('_griddb_python', |
| 93 | + sources=SOURCES, |
| 94 | + include_dirs=INCLUDES, |
| 95 | + libraries=LIBRARIES, |
| 96 | + extra_compile_args=COMPILE_ARGS, |
| 97 | + swig_opts=SWIG_OPTS, |
| 98 | + depends=DEPENDENTS, |
| 99 | + ) |
| 100 | + |
| 101 | +classifiers = [ |
| 102 | + "License :: OSI Approved :: Apache Software License", |
| 103 | + "Operating System :: POSIX :: Linux", |
| 104 | + "Programming Language :: Python", |
| 105 | + "Programming Language :: Python :: 3.6", |
| 106 | +] |
| 107 | + |
| 108 | +setup(name='griddb_python', |
| 109 | + version='0.8.2', |
| 110 | + author='Katsuhiko Nonomura', |
| 111 | + author_email='contact@griddb.org', |
| 112 | + description='GridDB Python Client Library built using SWIG', |
| 113 | + long_description=readme, |
| 114 | + ext_modules=[griddb_module], |
| 115 | + py_modules=['griddb_python'], |
| 116 | + url='https://github.com/griddb/python_client/', |
| 117 | + license='Apache Software License', |
| 118 | + cmdclass={'build': CustomBuild}, |
| 119 | + long_description_content_type = 'text/x-rst', |
| 120 | + classifiers=classifiers, |
| 121 | + ) |
0 commit comments