Permalink
Browse files

fixed setup.py.EXAMPLE

  • Loading branch information...
1 parent bf1fae3 commit d8ba8272d9e356ae0219e5b8c7f7243812950947 @b45ch1 committed May 11, 2010
Showing with 121 additions and 57 deletions.
  1. +121 −57 setup.py.EXAMPLE
View
@@ -1,81 +1,145 @@
#!/usr/bin/env python
+
+""" PYADOLC, Python Bindings to ADOL-C
+"""
+DOCLINES = __doc__.split("\n")
+
# build with: $ python setup.py build_ext --inplace
# clean with: # python setup.py clean --all
# see:
# http://www.scipy.org/Documentation/numpy_distutils
# http://docs.cython.org/docs/tutorial.html
-
-
+import os
+from distutils.core import setup, Extension
+from distutils.core import Command
from numpy.distutils.misc_util import get_numpy_include_dirs
-from numpy.distutils.misc_util import Configuration
-from numpy.distutils.core import setup
-from numpy.distutils.core import Command
# ADAPT THIS TO FIT YOUR SYSTEM
-include_dirs = [get_numpy_include_dirs(),'./adolc-2.0.0']
+include_dirs = [get_numpy_include_dirs(),'/home/b45ch1/workspace/SOLVINDSUITE/Packages/ADOL-C/Src/ADOL-C-2.1.0/ADOL-C/src']
extra_compile_args = ['-ftemplate-depth-100 -DBOOST_PYTHON_DYNAMIC_LIB']
-library_dirs = ['/data/walter/opt_software/boost_1_34_1/bin.v2/libs/python/build/gcc-4.2.1/release','./adolc-2.0.0/adolc/.libs']
-libraries = ['boost_python-gcc42-1_34_1','adolc']
-
+library_dirs = ['/home/b45ch1/workspace/SOLVINDSUITE/Packages/ADOL-C/adolc_base/lib']
+libraries = ['boost_python','adolc', 'ColPack']
+
+
+
+# PACKAGE INFORMATION
+CLASSIFIERS = """\
+Intended Audience :: Science/Research
+Intended Audience :: Developers
+License :: OSI Approved
+Programming Language :: C++
+Programming Language :: Python
+Topic :: Software Development
+Topic :: Scientific/Engineering
+Operating System :: Linux
+"""
+
+NAME = 'pyadolc'
+MAINTAINER = "Sebastian F. Walter"
+MAINTAINER_EMAIL = "sebastian.walter@gmail.com"
+DESCRIPTION = DOCLINES[0]
+LONG_DESCRIPTION = "\n".join(DOCLINES[2:])
+URL = "http://www.github.com/b45ch1/pyadolc"
+DOWNLOAD_URL = "http://www.github.com/b45ch1/pyadolc"
+LICENSE = 'BSD'
+CLASSIFIERS = filter(None, CLASSIFIERS.split('\n'))
+AUTHOR = "Sebastian F. Walter"
+AUTHOR_EMAIL = "sebastian.walter@gmail.com"
+PLATFORMS = ["Linux"]
+MAJOR = 0
+MINOR = 1
+MICRO = 0
+ISRELEASED = False
+VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO)
# IT IS USUALLY NOT NECESSARY TO CHANGE ANTHING BELOW THIS POINT
# override default setup.py help output
import sys
if len(sys.argv) == 1:
- print """
+ print """
- You didn't enter what to do!
+ You didn't enter what to do!
- Options:
- 1: build the extension with
- python setup.py build_ext --inplace
+ Options:
+ 1: build the extension with
+ python setup.py build_ext --inplace
- 2: remove generated files with
- python setup.py clean --all
+ 2: remove generated files with
+ python setup.py clean --all
- Remark: This is an override of the default behaviour of the distutils setup.
- """
- exit()
+ Remark: This is an override of the default behaviour of the distutils setup.
+ """
+ exit()
class clean(Command):
- """
- This class is used in numpy.distutils.core.setup.
- When $python setup.py clean is called, an instance of this class is created and then it's run method is called.
- """
-
- description = "Clean everything"
- user_options = [("all","a","the same")]
-
- def initialize_options(self):
- self.all = None
-
- def finalize_options(self):
- pass
-
- def run(self):
- import os
- os.system("rm -rf build")
- os.system("rm _adolc.so")
- os.system("rm -f py_adolc.os num_util.os")
- os.system("rm *.pyc")
-
-
-config = Configuration('',parent_package='',top_path='')
-config.add_extension(
-name = '_adolc',
-sources = ['py_adolc.cpp', 'num_util.cpp'],
-include_dirs = include_dirs,
-extra_compile_args = extra_compile_args,
-library_dirs = library_dirs,
-runtime_library_dirs = library_dirs,
-libraries = libraries
-)
-#include_dirs, define_macros, undef_macros, library_dirs, libraries, runtime_library_dirs, extra_objects, extra_compile_args, extra_link_args, export_symbols, swig_opts, depends, language, f2py_options, module_dirs, extra_info.
-
-options_dict = config.todict()
-options_dict['cmdclass'] = {'clean':clean}
-#, cmdclass = {'clean':clean}
-#setup(**config.todict())
+ """
+ This class is used in numpy.distutils.core.setup.
+ When $python setup.py clean is called, an instance of this class is created and then it's run method is called.
+ """
+
+ description = "Clean everything"
+ user_options = [("all","a","the same")]
+
+ def initialize_options(self):
+ self.all = None
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ import os
+ os.system("rm -rf build")
+ os.system("rm _adolc.so")
+ os.system("rm -f py_adolc.os num_util.os")
+ os.system("rm *.pyc")
+
+
+def fullsplit(path, result=None):
+ """
+ Split a pathname into components (the opposite of os.path.join) in a
+ platform-neutral way.
+ """
+ if result is None:
+ result = []
+ head, tail = os.path.split(path)
+ if head == '':
+ return [tail] + result
+ if head == path:
+ return result
+ return fullsplit(head, [tail] + result)
+
+# find all files that should be included
+packages, data_files = [], []
+for dirpath, dirnames, filenames in os.walk('adolc'):
+ # Ignore dirnames that start with '.'
+ for i, dirname in enumerate(dirnames):
+ if dirname.startswith('.'): del dirnames[i]
+ if '__init__.py' in filenames:
+ packages.append('.'.join(fullsplit(dirpath)))
+ elif filenames:
+ data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
+
+options_dict = {}
+options_dict.update({
+'name':NAME,
+'version':VERSION,
+'description' :DESCRIPTION,
+'long_description' : LONG_DESCRIPTION,
+'license':LICENSE,
+'author':AUTHOR,
+'platforms':PLATFORMS,
+'author_email': AUTHOR_EMAIL,
+'url':URL,
+'packages' :packages,
+'ext_package' : 'adolc',
+'ext_modules': [Extension('_adolc', ['adolc/src/py_adolc.cpp', 'adolc/src/num_util.cpp'],
+ include_dirs = ['adolc/src'] + include_dirs,
+ library_dirs = library_dirs,
+ runtime_library_dirs = library_dirs,
+ libraries = libraries)],
+'cmdclass' : {'clean':clean}
+})
+
setup(**options_dict)

0 comments on commit d8ba827

Please sign in to comment.