Annotation of python/pyGiNaC/setup.py, revision 1.14

1.1       pearu       1: #!/usr/bin/env python
                      2: 
                      3: import sys,os,string,time
                      4: 
1.14    ! pearu       5: #++++++++++++++ Require Python 2.x +++++++++++++
        !             6: 
1.1       pearu       7: if eval(sys.version[0])<2:
                      8:     print "You'll need Python 2.0 or higher to build PyGiNaC"
                      9:     sys.exit()
                     10: 
                     11: #++++++++++++++++++++ boost +++++++++++++++++++++
1.14    ! pearu      12: 
1.3       pearu      13: boost_dir = '/usr/local/share/boost'
                     14: 
1.14    ! pearu      15: if not os.path.isdir(boost_dir):
        !            16:     print 'boost_dir=%s must be existing directory'%(`boost_dir`)
        !            17:     print 'Fix this in setup.py'
        !            18:     sys.exit()
        !            19: 
        !            20: bpl_dir = os.path.join(boost_dir,'libs','python','src')
1.1       pearu      21: bpl_src = map(lambda f:os.path.join(bpl_dir,f),
                     22:               ['classes.cpp','conversions.cpp','extension_class.cpp',
                     23:                'functions.cpp','init_function.cpp','module_builder.cpp',
                     24:                'objects.cpp','types.cpp'])
                     25: 
                     26: #++++++++++++++++++++++++++++++++++++++++++++++++
                     27: from distutils.core import setup, Extension
                     28: 
1.14    ! pearu      29: #+++++HACK+++++ replace gcc with g++ +++++++++++++
1.1       pearu      30: from distutils import sysconfig
                     31: save_init_posix = sysconfig._init_posix
                     32: def my_init_posix():
                     33:     save_init_posix()
                     34:     g = sysconfig._config_vars
1.3       pearu      35:     if g['LDSHARED'][:3]=='gcc':
                     36:         print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
                     37:         g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
                     38:         print 'to',`g['LDSHARED']`
1.1       pearu      39: sysconfig._init_posix = my_init_posix
                     40: 
1.14    ! pearu      41: #++++++++++++++++ GiNaC._ginac +++++++++++++++++++++
1.1       pearu      42: 
1.5       pearu      43: ginac_cpp = os.path.join('src','_ginac.cpp')
                     44: ginac_cpp = os.path.join('tools','wrappers','ginac.cpp')
                     45: 
                     46: cppsrc = [ginac_cpp]
                     47: 
                     48: if 1:
1.6       pearu      49:     wrap_input = ['symbol','numeric','constant','relational',
1.11      pearu      50:                   'lst','idx','varidx','power','add','mul',
                     51:                   'ncmul','pseries','matrix','function','inifcns',
                     52:                   'function']
1.14    ! pearu      53:     #wrap_input = ['matrix']
1.5       pearu      54:     execfile(os.path.join('tools','wrappers','build.py'))
                     55:     wrapper_dir = os.path.join('tools','wrappers')
                     56:     build_ginac_cpp(wrap_input,ginac_cpp)
1.4       pearu      57: 
1.2       pearu      58: ginac_ext = Extension('GiNaC._ginac',
1.6       pearu      59:                       sources=cppsrc+bpl_src,
                     60:                       include_dirs=[boost_dir],
                     61:                       libraries=['ginac','cln'],
                     62:                       library_dirs=[],
                     63:                       define_macros=[('DEBUG_PYGINAC', None)],
1.2       pearu      64:                      )
1.3       pearu      65: 
1.1       pearu      66: 
                     67: #++++++++++++++++++++ setup +++++++++++++++++++++
                     68: 
                     69: setup (name = "PyGiNaC",
                     70:        version = "0.0.0",
                     71:        description = "",
                     72:        author = "Pearu Peterson",
                     73:        author_email = "pearu@cens.ioc.ee",
                     74:        licence = "LGPL",
                     75:        long_description= "",
                     76:        url = "",
                     77:        ext_modules = [ ginac_ext ],
                     78:        packages = ['GiNaC'],
                     79:        package_dir = {'GiNaC': 'lib'},
                     80:        )

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