File:  [CENS] / python / pyGiNaC / setup.py
Revision 1.30: download - view: text, annotated - select for diffs - revision graph
Thu May 31 17:57:45 2001 UTC (16 years, 5 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
*** empty log message ***

#!/usr/bin/env python
#
#   Setup file for building/installing PyGiNaC
#
# Requirements:
#   Python 2.1 or higher (http://www.python.org/)
#   GiNaC 0.8.1 or higher (http://www.ginac.de/)
#     For GiNaC, you'll need CLN 1.1 (http://clisp.cons.org/~haible/packages-cln.html)
#       Optional, but recommended, CLN can use GMP 3.1.1 (http://www.swox.com/gmp/)
#   Boost 1.21.1 or higher (http://www.boost.org/)
#  
# Usage:
#   > python setup.py install  # this will build and install ginac
#   > python setup.py test -v  # this will run doctests.
#
# In Python `import ginac'. See doc/ginac.doc.html for examples.
# See GiNaC documentation (http://www.ginac.de/tutorial/) for
# capabilities and limitations.
#
# Pearu Peterson <pearu@cens.ioc.ee>
# 26 April 2001

import sys,os

gentest = 0
if 'test' in sys.argv:
    i = sys.argv.index('test')
    gentest = 1
    if len(sys.argv)>i+1 and sys.argv[i+1]=='-v':
        gentest = 2
        del sys.argv[i+1]
    del sys.argv[i]

#++++++++++++++++++++ boost +++++++++++++++++++++

boost_dir = 'boost'
bpl_dir = os.path.join(boost_dir,'libs','python','src')
bpl_src = map(lambda f:os.path.join(bpl_dir,f),
              ['classes.cpp','conversions.cpp','extension_class.cpp',
               'functions.cpp','init_function.cpp','module_builder.cpp',
               'objects.cpp','types.cpp'])

#++++++++++++++++++++++++++++++++++++++++++++++++
from distutils.core import setup, Extension

#+++HACK: replace linker gcc with g++ +++++++++++

from distutils import sysconfig
save_init_posix = sysconfig._init_posix
def my_init_posix():
    save_init_posix()
    g = sysconfig._config_vars
    if g['LDSHARED'][:3]=='gcc':
        print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
        g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
        print 'to',`g['LDSHARED']`
sysconfig._init_posix = my_init_posix

#+++++++++++++++++ PyGiNaC version ++++++++++++++

wrapper_dir = 'wrappers3'
lib_dir = 'lib3'

major_version = 0
minor_version = 5
try: execfile(os.path.join('tools','get_revision.py'))
except: revision_version = 0
version='%d.%d.%d'%(major_version,minor_version,revision_version)

#++++++++++++++++ ginac._ginac +++++++++++++++++++++

ex_src = [
    os.path.join(wrapper_dir,'ginac_enhancements.cpp'),
    os.path.join(wrapper_dir,'ex_py.cpp'),
    os.path.join(wrapper_dir,'python_repr.cpp'),
    os.path.join(wrapper_dir,'python_str.cpp'),
    os.path.join(wrapper_dir,'python_csrc.cpp'),
    os.path.join(wrapper_dir,'pyfunc.cpp'),
    os.path.join(wrapper_dir,'slice.c'),
    ]

if gentest:
    fon = os.path.join(lib_dir,'doc','__init__.py')
    if gentest==2:
        os.system('%s %s -v'%(sys.executable,fon))
    elif gentest==1:
        os.system('%s %s'%(sys.executable,fon))

if len(sys.argv)==1:
    print "PyGiNaC Version",version
    sys.exit()

ginac_ext = Extension('ginac._ginac',
                      sources=ex_src+bpl_src,
                      include_dirs=[boost_dir,wrapper_dir],
                      libraries=['ginac','cln'],
# Add here the paths to the location
# of ginac and cln libraries:
                      library_dirs=[], 
                      )

#++++++++++++++++++++ setup +++++++++++++++++++++

setup (name = "PyGiNaC",
       version = version,
       description = "PyGiNaC --- Python Interface to GiNaC",
       author = "Pearu Peterson",
       author_email = "pearu@cens.ioc.ee",
       maintainer = "Pearu Peterson",
       maintainer_email = "pearu@cens.ioc.ee",
       licence = "LGPL",
       long_description= """
GiNaC is an open framework for symbolic computation within the C++
programming language (http://www.ginac.de/).
PyGiNaC is a Python extension package that provides
an interface to the GiNaC library.
""",
       url = "http://cens.ioc.ee/projects/pyginac/",
       ext_modules = [ ginac_ext ],
       packages = ['ginac','ginac.doc'],
       package_dir = {'ginac': lib_dir,
                      'ginac.doc':os.path.join(lib_dir,'doc') },
       )

print "PyGiNaC Version",version

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>