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

1.1       pearu       1: #!/usr/bin/env python
1.15      pearu       2: #
                      3: #   Setup file for building/installing PyGiNaC
                      4: #
                      5: # Requirements:
1.28    ! pearu       6: #   Python 2.1 or higher (http://www.python.org/)
        !             7: #   GiNaC 0.8.1 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/)
1.21      pearu      11: #  
1.15      pearu      12: # Usage:
1.28    ! pearu      13: #   > python setup.py install  # this will build and install ginac
        !            14: #   > python setup.py test -v  # this will run doctests.
1.15      pearu      15: #
1.28    ! pearu      16: # In Python `import ginac'. See doc/ginac.doc.html for examples.
        !            17: # See GiNaC documentation (http://www.ginac.de/tutorial/) for
        !            18: # capabilities and limitations.
1.15      pearu      19: #
                     20: # Pearu Peterson <pearu@cens.ioc.ee>
1.28    ! pearu      21: # 26 April 2001
1.23      pearu      22: 
1.28    ! pearu      23: import sys,os
1.1       pearu      24: 
1.25      pearu      25: gentest = 0
                     26: if 'test' in sys.argv:
                     27:     i = sys.argv.index('test')
                     28:     gentest = 1
                     29:     if len(sys.argv)>i+1 and sys.argv[i+1]=='-v':
                     30:         gentest = 2
                     31:         del sys.argv[i+1]
                     32:     del sys.argv[i]
1.28    ! pearu      33: 
1.1       pearu      34: #++++++++++++++++++++ boost +++++++++++++++++++++
1.14      pearu      35: 
1.28    ! pearu      36: boost_dir = 'boost'
1.14      pearu      37: bpl_dir = os.path.join(boost_dir,'libs','python','src')
1.1       pearu      38: bpl_src = map(lambda f:os.path.join(bpl_dir,f),
                     39:               ['classes.cpp','conversions.cpp','extension_class.cpp',
                     40:                'functions.cpp','init_function.cpp','module_builder.cpp',
                     41:                'objects.cpp','types.cpp'])
                     42: 
                     43: #++++++++++++++++++++++++++++++++++++++++++++++++
                     44: from distutils.core import setup, Extension
                     45: 
1.15      pearu      46: #+++HACK: replace linker gcc with g++ +++++++++++
1.28    ! pearu      47: 
1.1       pearu      48: from distutils import sysconfig
                     49: save_init_posix = sysconfig._init_posix
                     50: def my_init_posix():
                     51:     save_init_posix()
                     52:     g = sysconfig._config_vars
1.3       pearu      53:     if g['LDSHARED'][:3]=='gcc':
                     54:         print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
                     55:         g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
                     56:         print 'to',`g['LDSHARED']`
1.1       pearu      57: sysconfig._init_posix = my_init_posix
                     58: 
1.16      pearu      59: #+++++++++++++++++ PyGiNaC version ++++++++++++++
                     60: 
1.28    ! pearu      61: wrapper_dir = 'wrappers3'
        !            62: lib_dir = 'lib3'
        !            63: 
1.16      pearu      64: major_version = 0
1.28    ! pearu      65: minor_version = 4
1.16      pearu      66: try: execfile(os.path.join('tools','get_revision.py'))
                     67: except: revision_version = 0
                     68: version='%d.%d.%d'%(major_version,minor_version,revision_version)
                     69: 
                     70: #++++++++++++++++ ginac._ginac +++++++++++++++++++++
1.1       pearu      71: 
1.28    ! pearu      72: ex_src = [
        !            73:     os.path.join(wrapper_dir,'ginac_enhancements.cpp'),
        !            74:     os.path.join(wrapper_dir,'ex_py.cpp'),
        !            75:     os.path.join(wrapper_dir,'python_repr.cpp'),
        !            76:     os.path.join(wrapper_dir,'python_str.cpp'),
        !            77:     os.path.join(wrapper_dir,'pyfunc.cpp'),
        !            78:     os.path.join(wrapper_dir,'slice.c'),
        !            79:     ]
1.25      pearu      80: 
                     81: if gentest:
1.28    ! pearu      82:     fon = os.path.join(lib_dir,'doc','__init__.py')
1.25      pearu      83:     if gentest==2:
1.28    ! pearu      84:         os.system('%s %s -v'%(sys.executable,fon))
        !            85:     elif gentest==1:
        !            86:         os.system('%s %s'%(sys.executable,fon))
1.25      pearu      87: 
                     88: if len(sys.argv)==1:
                     89:     print "PyGiNaC Version",version
                     90:     sys.exit()
1.4       pearu      91: 
1.15      pearu      92: ginac_ext = Extension('ginac._ginac',
1.28    ! pearu      93:                       sources=ex_src+bpl_src,
1.25      pearu      94:                       include_dirs=[boost_dir,wrapper_dir],
1.6       pearu      95:                       libraries=['ginac','cln'],
1.28    ! pearu      96: # Add here the paths to the location
        !            97: # of ginac and cln libraries:
        !            98:                       library_dirs=[], 
1.21      pearu      99:                       )
1.1       pearu     100: 
                    101: #++++++++++++++++++++ setup +++++++++++++++++++++
                    102: 
                    103: setup (name = "PyGiNaC",
1.15      pearu     104:        version = version,
1.28    ! pearu     105:        description = "PyGiNaC --- Python Interface to GiNaC",
1.1       pearu     106:        author = "Pearu Peterson",
                    107:        author_email = "pearu@cens.ioc.ee",
1.16      pearu     108:        maintainer = "Pearu Peterson",
                    109:        maintainer_email = "pearu@cens.ioc.ee",
1.1       pearu     110:        licence = "LGPL",
1.15      pearu     111:        long_description= """
                    112: GiNaC is an open framework for symbolic computation within the C++
                    113: programming language (http://www.ginac.de/).
1.28    ! pearu     114: PyGiNaC is a Python extension package that provides
        !           115: an interface to the GiNaC library.
1.15      pearu     116: """,
                    117:        url = "http://cens.ioc.ee/projects/pyginac/",
1.1       pearu     118:        ext_modules = [ ginac_ext ],
1.23      pearu     119:        packages = ['ginac','ginac.doc'],
1.28    ! pearu     120:        package_dir = {'ginac': lib_dir,
        !           121:                       'ginac.doc':os.path.join(lib_dir,'doc') },
1.1       pearu     122:        )
1.15      pearu     123: 
                    124: print "PyGiNaC Version",version

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