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

"""

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
5 6 7 8 9 10 11 12
>> 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/)

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

LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
17 18
To build deb package :
======================
19 20
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
21 22 23
To build MacOSX :
=================
1) use clang compiler and python3
24
2) build
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
25
CC=/usr/bin/cc CXX=/usr/bin/c++ python3 setup.py build_ext -L ${HOME}/local/unsio/lib -R ${HOME}/local/unsio/lib
26
3) install locally
LAMBERT Jean-charles's avatar
LAMBERT Jean-charles committed
27 28 29 30
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
31
>> INSTALL
32 33


34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
"""

#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()

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

setup(
    name='python'+pyversion+'-unsio',
    version='1.0',
    description='Python wrapper to unsio',
    author='Jean-Charles LAMBERT',
    author_email='jean-charles.lambert@lam.fr',
    url='https://projets.lam.fr/projects/unsio',
    # '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'],
              library_dirs=['/usr/lib64','/lib64'],
              runtime_library_dirs=['/usr/lib64','/lib64']
              #library_dirs=[os.environ['NEMOLIB']],
              #runtime_library_dirs=[os.environ['NEMOLIB']]
              )
    ],
    install_requires=['numpy'],
    setup_requires=['numpy']
    #
    #py_modules = ["py_baryc"]
    #data_files=[('',['src/numpy.i'])]
)