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