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

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

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
6 7 8 9 10 11 12 13
>> PACKAGING

Dependencies :
==============
apt-get install python3-stdeb fakeroot python3-all-dev python3-all swig python3-numpy python3-setuptools
apt-get install python-stdeb fakeroot python-all-dev python-all swig python-numpy python-setuptools libsqlite3-dev
( see https://pypi.org/project/stdeb/)

14
To build RPM :
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
15
==============
16 17
python3 setup.py  bdist_rpm --release 1mga6

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
18 19
To build deb package :
======================
20 21
python3 setup.py --command-packages=stdeb.command bdist_deb sdist_dsc --with-python2=True --with-python3=True --dist-dir=my_deb --debian-version 0ubuntu16.04

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
22 23 24
To build MacOSX :
=================
1) use clang compiler and python3
25
2) build
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
26
CC=/usr/bin/cc CXX=/usr/bin/c++ python3 setup.py build_ext -L ${HOME}/local/unsio/lib -R ${HOME}/local/unsio/lib
27
3) install locally
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
28 29 30 31
python3 setup.py install --user
4) set DYLD_LIBRARY_PATH
export DYLD_LIBRARY_PATH=${HOME}/local/unsio/lib

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
32
>> INSTALL
33

34 35 36 37 38 39 40 41 42 43 44 45
"""

#from distutils.core import setup, Extension
import numpy,os,sys
from setuptools import setup, Extension

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

46 47 48
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.")

49 50 51 52 53
# detect python version (2 or 3)
pyversion="3"
if sys.version_info[0]<3 :
  pyversion=""

54 55 56

long_description="""\

LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
57 58
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).

59
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
60 61 62
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.
63 64
"""
  
65
setup(
66 67
    #name='python'+pyversion+'-unsio',
    name='python-unsio',
68
    version='1.0',
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
69
    description='A python wrapper to unsio',
70
    long_description=long_description,
71 72 73
    author='Jean-Charles LAMBERT',
    author_email='jean-charles.lambert@lam.fr',
    url='https://projets.lam.fr/projects/unsio',
74
    license='CeCILL2.1 (https://opensource.org/licenses/CECILL-2.1)',
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
75
    classifiers = [
76 77
                   "Intended Audience :: Developers",
                   "Intended Audience :: Science/Research",
LAMBERT Jean-charles's avatar
updates  
LAMBERT Jean-charles committed
78 79 80 81 82 83 84 85 86 87 88 89
                   "Programming Language :: C",
                   "Programming Language :: C++",
                   "Programming Language :: Python",
                   "Programming Language :: Python :: 2",
                   "Programming Language :: Python :: 2.7",
                   "Programming Language :: Python :: 3",
                   "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"],
90 91
    platforms = ["Linux", "Mac OS-X", "Unix"],
    python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
92 93 94 95 96 97 98 99 100 101
    # 'unsio' -> installation directory
    # 'swig'   -> about all the py source in 'src'
    package_dir={'unsio':'py/swig'},
    packages=['unsio'],
    ext_modules = [
        Extension("unsio/_py_unsio", 
              sources=[ "py/swig/py_unsio.i"],
              swig_opts=['-c++','-modern', '-Isrc','-I./py/swig', '-Iswig'],
              include_dirs = [numpy_include,'src'],
              libraries=['unsio'],
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
102 103
              library_dirs=['/Users/jcl/local/unsio/lib','/usr/lib64','/lib64'],
              runtime_library_dirs=['/Users/jcl/local/unsio/lib','/usr/lib64','/lib64']
104 105 106 107
              #library_dirs=[os.environ['NEMOLIB']],
              #runtime_library_dirs=[os.environ['NEMOLIB']]
              )
    ],
108
    #install_requires=['numpy'],
109 110 111 112 113
    setup_requires=['numpy']
    #
)