setup.py 3.73 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
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
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 47 48

# 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")
        return super().run()

49
setup(
50 51
    #name='python'+pyversion+'-unsio',
    name='python-unsio',
52
    version='0.9.2',
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
53
    description='A python wrapper to unsio',
54
    long_description=long_description,
55 56 57
    author='Jean-Charles LAMBERT',
    author_email='jean-charles.lambert@lam.fr',
    url='https://projets.lam.fr/projects/unsio',
58
    license='CeCILL2.1 (https://opensource.org/licenses/CECILL-2.1)',
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
59
    classifiers = [
60 61
                   "Intended Audience :: Developers",
                   "Intended Audience :: Science/Research",
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
62 63 64 65 66 67 68 69 70 71
                   "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"],
72 73
    platforms = ["Linux", "Mac OS-X", "Unix"],
    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
74 75 76 77 78 79
    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'],   
80 81
    ext_modules = [
        Extension("unsio/_py_unsio", 
82 83
              sources=[ "py/unsio/py_unsio.i"],
              swig_opts=['-c++','-modern', '-Isrc','-I./py/unsio', '-Iswig'],
84 85
              include_dirs = [numpy_include,'src'],
              libraries=['unsio'],
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
86 87
              library_dirs=['/Users/jcl/local/unsio/lib','/usr/lib64','/lib64'],
              runtime_library_dirs=['/Users/jcl/local/unsio/lib','/usr/lib64','/lib64']
88 89
              )
    ],
90
    #install_requires=['numpy'],
91 92 93 94 95
    setup_requires=['numpy']
    #
)