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

1.1       pearu       1: #!/usr/bin/env python
1.15    ! pearu       2: #
        !             3: #   Setup file for building/installing PyGiNaC
        !             4: #
        !             5: # Requirements:
        !             6: #   Python 2.0 or higher (http://www.python.org/)
        !             7: #   GiNaC 0.8.0 or higher (http://www.ginac.de/)
        !             8: #   Boost 1.21.1 or higher (http://www.boost.org/)
        !             9: #
        !            10: # Usage:
        !            11: #   > python setup.py install
        !            12: #
        !            13: # Note:
        !            14: #   Compilation of PyGiNaC requires more than 160MB memory (with gcc).
        !            15: #   However, if you don't need all the GiNaC classes to be exposed
        !            16: #   to Python, you can edit the list `wrap_input' below to indicate
        !            17: #   your needs. You don't need to worry about class dependencies ---
        !            18: #   they are solved automatically.
        !            19: #
        !            20: # Pearu Peterson <pearu@cens.ioc.ee>
        !            21: # 30 March 2001
1.1       pearu      22: 
                     23: import sys,os,string,time
                     24: 
1.14      pearu      25: #++++++++++++++ Require Python 2.x +++++++++++++
                     26: 
1.1       pearu      27: if eval(sys.version[0])<2:
                     28:     print "You'll need Python 2.0 or higher to build PyGiNaC"
                     29:     sys.exit()
                     30: 
                     31: #++++++++++++++++++++ boost +++++++++++++++++++++
1.14      pearu      32: 
1.3       pearu      33: boost_dir = '/usr/local/share/boost'
                     34: 
1.14      pearu      35: if not os.path.isdir(boost_dir):
1.15    ! pearu      36:     print 'boost_dir=%s must be existing directory.'%(`boost_dir`)
        !            37:     print 'Get Boost from http://www.boost.org/ and fix its path in setup.py'
1.14      pearu      38:     sys.exit()
                     39: 
                     40: bpl_dir = os.path.join(boost_dir,'libs','python','src')
1.1       pearu      41: bpl_src = map(lambda f:os.path.join(bpl_dir,f),
                     42:               ['classes.cpp','conversions.cpp','extension_class.cpp',
                     43:                'functions.cpp','init_function.cpp','module_builder.cpp',
                     44:                'objects.cpp','types.cpp'])
                     45: 
                     46: #++++++++++++++++++++++++++++++++++++++++++++++++
                     47: from distutils.core import setup, Extension
                     48: 
1.15    ! pearu      49: #+++HACK: replace linker gcc with g++ +++++++++++
1.1       pearu      50: from distutils import sysconfig
                     51: save_init_posix = sysconfig._init_posix
                     52: def my_init_posix():
                     53:     save_init_posix()
                     54:     g = sysconfig._config_vars
1.3       pearu      55:     if g['LDSHARED'][:3]=='gcc':
                     56:         print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
                     57:         g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
                     58:         print 'to',`g['LDSHARED']`
1.1       pearu      59: sysconfig._init_posix = my_init_posix
                     60: 
1.14      pearu      61: #++++++++++++++++ GiNaC._ginac +++++++++++++++++++++
1.1       pearu      62: 
1.5       pearu      63: ginac_cpp = os.path.join('src','_ginac.cpp')
                     64: ginac_cpp = os.path.join('tools','wrappers','ginac.cpp')
                     65: 
                     66: cppsrc = [ginac_cpp]
                     67: 
1.15    ! pearu      68: if 1 or not os.path.exists(ginac_cpp):
1.6       pearu      69:     wrap_input = ['symbol','numeric','constant','relational',
1.11      pearu      70:                   'lst','idx','varidx','power','add','mul',
                     71:                   'ncmul','pseries','matrix','function','inifcns',
                     72:                   'function']
1.15    ! pearu      73:     wrap_input = ['matrix']
1.5       pearu      74:     execfile(os.path.join('tools','wrappers','build.py'))
                     75:     wrapper_dir = os.path.join('tools','wrappers')
                     76:     build_ginac_cpp(wrap_input,ginac_cpp)
1.4       pearu      77: 
1.15    ! pearu      78: ginac_ext = Extension('ginac._ginac',
1.6       pearu      79:                       sources=cppsrc+bpl_src,
                     80:                       include_dirs=[boost_dir],
                     81:                       libraries=['ginac','cln'],
                     82:                       library_dirs=[],
                     83:                       define_macros=[('DEBUG_PYGINAC', None)],
1.2       pearu      84:                      )
1.15    ! pearu      85: #+++++++++++++++++ PyGiNaC version ++++++++++++++
        !            86: 
        !            87: major_version = 0
        !            88: minor_version = 0
        !            89: execfile(os.path.join('tools','get_revision.py'))
        !            90: version='%d.%d.%d'%(major_version,minor_version,revision_version)
1.3       pearu      91: 
1.1       pearu      92: 
                     93: #++++++++++++++++++++ setup +++++++++++++++++++++
                     94: 
                     95: setup (name = "PyGiNaC",
1.15    ! pearu      96:        version = version,
        !            97:        description = "PyGiNaC --- the wrapper of C++ library GiNaC to Python",
1.1       pearu      98:        author = "Pearu Peterson",
                     99:        author_email = "pearu@cens.ioc.ee",
                    100:        licence = "LGPL",
1.15    ! pearu     101:        long_description= """
        !           102: GiNaC is an open framework for symbolic computation within the C++
        !           103: programming language (http://www.ginac.de/).
        !           104: PyGiNaC is a Python package that provides a transparent interface
        !           105: to GiNaC library. Currently the following GiNaC classes are exposed:
        !           106:   ex, symbol, numeric, constant, relational, add, mul, power, ncmul,
        !           107:   matrix, pseries, function, idx, varidx,
        !           108:   lst, exvector, expair, exlist, epvector.
        !           109: In addition, PyGiNaC provides wrappers for various elementary functions,
        !           110: such as sin, cos, tan, etc.
        !           111: """,
        !           112:        url = "http://cens.ioc.ee/projects/pyginac/",
1.1       pearu     113:        ext_modules = [ ginac_ext ],
1.15    ! pearu     114:        packages = ['ginac'],
        !           115:        package_dir = {'ginac': 'lib'},
1.1       pearu     116:        )
1.15    ! pearu     117: 
        !           118: print "PyGiNaC Version",version

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