Commit 03c745ab authored by LAMBERT Jean-charles's avatar LAMBERT Jean-charles Committed by LAMBERT Jean-charles
Browse files

new_setup

parent 46f7c23f
......@@ -46,13 +46,15 @@ from setuptools import setup, Extension
from setuptools.command.build_py import build_py as _build_py
# find out numpy include directory.
# find out numpy include directory.
try:
numpy_include = numpy.get_include()
except AttributeError:
numpy_include = numpy.get_numpy_include()
#DEHNEN=$ENV{NEMO}/usr/dehnen
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.")
# detect python version (2 or 3)
pyversion="3"
......@@ -71,57 +73,116 @@ class build_py(_build_py, object):
return super(build_py, self).run()
else: # python3
return super().run()
setup(
name='python'+pyversion+'-unsiotools',
version='1.0',
description='Python wrapper to unsiotools',
author='Jean-Charles LAMBERT',
author_email='jean-charles.lambert@lam.fr',
url='https://projets.lam.fr/projects/uns_projects',
# 'unsiotools' -> installation directory
# 'py/lib/swig' -> about all the py source in 'src'
package_dir={'unsiotools':'py/lib/swig'},
packages=['unsiotools'],
ext_modules = [
Extension("unsiotools/_py_unstools",
sources=[ "py/lib/swig/py_unstools.i"],
swig_opts=['-c++','-modern', '-DNO_CUDA -DNOBOOST',
'-Isrc','-I./py/lib/swig', '-Iswig','-Ilib/utils','-Ilib/utils/nemodep', '-Ilib/projects/nemodep'],
include_dirs = [numpy_include,'src',
'lib/utils',
'lib/utils/nemodep',
'lib/projects/nemodep',
os.environ['NEMO']+'/usr/dehnen/utils',
os.environ['NEMO']+'/usr/dehnen/utils/inc',
os.environ['NEMO']+'/usr/dehnen/falcON',
os.environ['NEMO']+'/usr/dehnen/falcON/inc',
os.environ['NEMO']+'/usr/dehnen/falcON/public',
os.environ['NEMO']+'/inc'
],
cmdclass={'build_py': build_py},
extra_compile_args = ['-O2'],
define_macros=[('NOBOOST',None), # equivalent to -DNOBOOST
('falcON_SINGLE',None),
('falcON_NEMO',None),
('NO_CUDA',None) ],
# NOTE : libraries linking order is VERY important !!!
libraries=['JCLutils', 'JCLprojects','unsio', 'WDutils', 'falcON', 'nemo','cpgplot', 'pgplot','sqlite3','X11','gfortran'],
library_dirs=['/usr/lib64','/lib64',os.environ['HOME']+'/local/unsiotools/lib',
os.environ['NEMO']+'/lib',
os.environ['NEMO']+'/usr/dehnen/utils/lib',
os.environ['NEMO']+'/usr/dehnen/falcON/lib'],
runtime_library_dirs=['/usr/lib64','/lib64',os.environ['HOME']+'/local/unsiotools/lib',
os.environ['NEMO']+'/lib',
os.environ['NEMO']+'/usr/dehnen/utils/lib',
os.environ['NEMO']+'/usr/dehnen/falcON/lib' ]
)
],
install_requires=['numpy'],
setup_requires=['numpy']
#
# version management
#
MAJOR = '0'
MINOR = '9'
MICRO = '2rc2'
VERSION = '%s.%s.%s' % (MAJOR, MINOR, MICRO)
#
# write_version : write unsio version in py/unsio/version.py file
# it's imported from __init__.py as __version__
def write_version_py(filename='py/unsio/version.py'):
cnt = """
# THIS FILE IS GENERATED FROM PYTHON-UNSIO SETUP.PY
#
version = '%(version)s'
"""
a = open(filename, 'w')
try:
a.write(cnt % {'version': VERSION})
finally:
a.close()
s#
# setup_package :
#
def setup_package():
# generate version
write_version_py()
# metada for setup
metadata = dict(
name='python-unsiotools',
version=VERSION,
description='Python wrapper to unsiotools',
long_description=long_description,
author='Jean-Charles LAMBERT',
author_email='jean-charles.lambert@lam.fr',
url='https://projets.lam.fr/projects/uns_projects',
license='CeCILL2.1 (https://opensource.org/licenses/CECILL-2.1)',
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"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"],
platforms=["Linux", "Mac OS-X", "Unix"],
python_requires='>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*',
cmdclass={'build_py': build_py},
package_dir={'':'py'}, # all packages are under 'py' directory
packages=['unsiotools', 'unsiotools/simulations'],
cmdclass={'build_py': build_py},
py_modules=['unsiotools/py_unstools'],
ext_modules = [
Extension("unsiotools/_py_unstools",
sources=[ "py/unsiotools/py_unstools.i"],
swig_opts=['-c++','-modern', '-DNO_CUDA -DNOBOOST',
'-Isrc','-I./py/unsiotools', '-Iswig','-Ilib/utils','-Ilib/utils/nemodep', '-Ilib/projects/nemodep'],
include_dirs = [numpy_include,'src',
'lib/utils',
'lib/utils/nemodep',
'lib/projects/nemodep',
os.environ['NEMO']+'/usr/dehnen/utils',
os.environ['NEMO']+'/usr/dehnen/utils/inc',
os.environ['NEMO']+'/usr/dehnen/falcON',
os.environ['NEMO']+'/usr/dehnen/falcON/inc',
os.environ['NEMO']+'/usr/dehnen/falcON/public',
os.environ['NEMO']+'/inc'
],
extra_compile_args = ['-O2'],
define_macros=[('NOBOOST',None), # equivalent to -DNOBOOST
('falcON_SINGLE',None),
('falcON_NEMO',None),
('NO_CUDA',None) ],
# NOTE : libraries linking order is VERY important !!!
libraries=['JCLutils', 'JCLprojects','unsio', 'WDutils', 'falcON', 'nemo','cpgplot', 'pgplot','sqlite3','X11','gfortran'],
library_dirs=['/usr/lib64','/lib64',os.environ['HOME']+'/local/unsiotools/lib',
os.environ['NEMO']+'/lib',
os.environ['NEMO']+'/usr/dehnen/utils/lib',
os.environ['NEMO']+'/usr/dehnen/falcON/lib'],
runtime_library_dirs=['/usr/lib64','/lib64',os.environ['HOME']+'/local/unsiotools/lib',
os.environ['NEMO']+'/lib',
os.environ['NEMO']+'/usr/dehnen/utils/lib',
os.environ['NEMO']+'/usr/dehnen/falcON/lib' ]
)
],
install_requires=['numpy'],
setup_requires=['numpy']
)
setup(**metadata)
#
#py_modules = ["py_baryc"]
#data_files=[('',['src/numpy.i'])]
)
# main
#
if __name__ == '__main__':
setup_package()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment