File:  [CENS] / python / pyGiNaC / libboostpython / setup.py
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Nov 20 17:11:13 2001 UTC (16 years ago) by pearu
Branches: MAIN
CVS tags: HEAD
Catching up latest GiNaC and BPL

#!/usr/bin/env python
#
#   Setup file for building Boost.Python shared library
#
# Pearu Peterson <pearu@cens.ioc.ee>
# 20 November 2001

import sys,os

__author__ = 'Pearu Peterson <pearu@cens.ioc.ee>'

#++++++++++++++++++++ boost.python +++++++++++++++++++++

boost_dir = '../boost'
if not os.path.isdir(boost_dir):
    print 'boost_dir=%s must be existing directory.'%(`boost_dir`)
    print '  Get Boost from http://www.boost.org/'
    print '  Fix its path 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',
               #'cross_module.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

#+++++++++++++ _libboostpython +++++++++++++++++++
ext = Extension('_libboostpython',
                sources=bpl_src + ['_libboostpython.c'],
                include_dirs=[boost_dir],
                )

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

setup (name = "libboostpython",
       version = '0.1',
       description = "libboostpython - create Boost.Python shared library",
       author = "Pearu Peterson",
       author_email = "pearu@cens.ioc.ee",
       maintainer = "Pearu Peterson",
       maintainer_email = "pearu@cens.ioc.ee",
       licence = "LGPL",
       url = "http://cens.ioc.ee/projects/pyginac/",
       ext_modules = [ext],
       )


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