setup.py 3.96 KB
Newer Older
1 2 3
#!/usr/bin/env python

"""
4
UNSIO : Universal Nbody Snapshot Input Output
5 6 7

"""

8
from distutils.core import setup, Extension
9
import numpy,os,sys
10 11 12 13
from setuptools import setup, Extension, find_packages
from setuptools.command.build_py import build_py as _build_py

#import setuptools.command.build_ext 
14 15 16 17 18 19 20

#  find out numpy include directory. 
try:
    numpy_include = numpy.get_include()
except AttributeError:
    numpy_include = numpy.get_numpy_include()

21 22 23
if sys.version_info[:2] < (2, 7) or (3, 0) <= sys.version_info[:2] < (3, 4):
    raise RuntimeError("Python version 2.7 or >= 3.4 required.")

24 25 26 27 28
# detect python version (2 or 3)
pyversion="3"
if sys.version_info[0]<3 :
  pyversion=""

29 30 31

long_description="""\

LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
32 33
UNSIO (*U*niversal *N*body *S*napshot *I*nput *O*utput) is an API which perform input/output operations in a generic way, and on different kind of nbody files format (nemo, Gadget binaries 1 and 2, Gadget hdf5, Ramses).

34
By using this API, a user could write only one analysis program which will work on all known files format supported by UNSIO.
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
35 36 37
It's not necessary anymore to know how is implemented a file format, UNSIO will do transparently and automatically all the hard work for you ! With UNSIO, you will spend less time to develop your analysis program.

UNSIO comes with an integrated sqlite3 database which can be used to retrieve automatically all your data among terabytes of hard disks.
38
"""
39 40 41 42 43 44 45 46

# trick to add SWIG generated module
# see https://stackoverflow.com/questions/12491328/python-distutils-not-include-the-swig-generated-module
# and especially : https://stackoverflow.com/questions/29477298/setup-py-run-build-ext-before-anything-else/48942866#48942866

class build_py(_build_py):
    def run(self):
        self.run_command("build_ext")
47 48 49 50
        if pyversion=="":  # python2
            return super().run()
        else:              # python3
            return super().run()
51

52
setup(
53 54
    #name='python'+pyversion+'-unsio',
    name='python-unsio',
55
    version='0.9.2',
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
56
    description='A python wrapper to unsio',
57
    long_description=long_description,
58 59 60
    author='Jean-Charles LAMBERT',
    author_email='jean-charles.lambert@lam.fr',
    url='https://projets.lam.fr/projects/unsio',
61
    license='CeCILL2.1 (https://opensource.org/licenses/CECILL-2.1)',
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
62
    classifiers = [
63 64
                   "Intended Audience :: Developers",
                   "Intended Audience :: Science/Research",
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
65 66 67 68 69 70 71 72 73 74
                   "Programming Language :: C",
                   "Programming Language :: C++",
                   "Programming Language :: Python",
                   "Programming Language :: Python :: 2.7",
                   "Programming Language :: Python :: 3.4",
                   "Programming Language :: Python :: 3.5",
                   "Programming Language :: Python :: 3.6",
                   "Programming Language :: Python :: 3.7",
                   "Topic :: Scientific/Engineering :: Astronomy",
                   "Topic :: Software Development"],
75 76
    platforms = ["Linux", "Mac OS-X", "Unix"],
    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
77 78 79 80 81 82
    package_dir={'':'py'},  # all packages are under 'py' directory
    packages=['unsio','unsio/test'],
    #cmdclass = {'install':Build_ext_first},
    #cmdclass={'build': CustomBuild, 'install': CustomInstall},
    cmdclass = {'build_py' : build_py},
    py_modules=['unsio/py_unsio'],   
83 84
    ext_modules = [
        Extension("unsio/_py_unsio", 
85 86
              sources=[ "py/unsio/py_unsio.i"],
              swig_opts=['-c++','-modern', '-Isrc','-I./py/unsio', '-Iswig'],
87 88
              include_dirs = [numpy_include,'src'],
              libraries=['unsio'],
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
89 90
              library_dirs=['/Users/jcl/local/unsio/lib','/usr/lib64','/lib64'],
              runtime_library_dirs=['/Users/jcl/local/unsio/lib','/usr/lib64','/lib64']
91 92
              )
    ],
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
93 94 95 96 97
    entry_points = {
       "console_scripts": [
          "test_unsio_lib = unsio.test.ctestunsio:commandLine",
       ],
    },
98
    #install_requires=['numpy'],
99 100 101 102 103
    setup_requires=['numpy']
    #
)