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

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

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