File:  [CENS] / python / pyGiNaC / setup.py
Revision 1.14: download - view: text, annotated - select for diffs - revision graph
Fri Mar 30 15:24:14 2001 UTC (16 years, 8 months ago) by pearu
Branches: MAIN
CVS tags: HEAD
Got function working properly, fixed bugs

#!/usr/bin/env python

import sys,os,string,time

#++++++++++++++ Require Python 2.x +++++++++++++

if eval(sys.version[0])<2:
    print "You'll need Python 2.0 or higher to build PyGiNaC"
    sys.exit()

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

boost_dir = '/usr/local/share/boost'

if not os.path.isdir(boost_dir):
    print 'boost_dir=%s must be existing directory'%(`boost_dir`)
    print 'Fix this in setup.py'
    sys.exit()

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 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

#++++++++++++++++ GiNaC._ginac +++++++++++++++++++++

ginac_cpp = os.path.join('src','_ginac.cpp')
ginac_cpp = os.path.join('tools','wrappers','ginac.cpp')

cppsrc = [ginac_cpp]

if 1:
    wrap_input = ['symbol','numeric','constant','relational',
                  'lst','idx','varidx','power','add','mul',
                  'ncmul','pseries','matrix','function','inifcns',
                  'function']
    #wrap_input = ['matrix']
    execfile(os.path.join('tools','wrappers','build.py'))
    wrapper_dir = os.path.join('tools','wrappers')
    build_ginac_cpp(wrap_input,ginac_cpp)

ginac_ext = Extension('GiNaC._ginac',
                      sources=cppsrc+bpl_src,
                      include_dirs=[boost_dir],
                      libraries=['ginac','cln'],
                      library_dirs=[],
                      define_macros=[('DEBUG_PYGINAC', None)],
                     )


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

setup (name = "PyGiNaC",
       version = "0.0.0",
       description = "",
       author = "Pearu Peterson",
       author_email = "pearu@cens.ioc.ee",
       licence = "LGPL",
       long_description= "",
       url = "",
       ext_modules = [ ginac_ext ],
       packages = ['GiNaC'],
       package_dir = {'GiNaC': 'lib'},
       )

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