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

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.31    ! pearu      25: print 'This setup.py file is obsolete. Use setup4.py instead.'
        !            26: sys.exit ()
        !            27: 
1.25      pearu      28: gentest = 0
                     29: if 'test' in sys.argv:
                     30:     i = sys.argv.index('test')
                     31:     gentest = 1
                     32:     if len(sys.argv)>i+1 and sys.argv[i+1]=='-v':
                     33:         gentest = 2
                     34:         del sys.argv[i+1]
                     35:     del sys.argv[i]
1.28      pearu      36: 
1.1       pearu      37: #++++++++++++++++++++ boost +++++++++++++++++++++
1.14      pearu      38: 
1.28      pearu      39: boost_dir = 'boost'
1.14      pearu      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.28      pearu      50: 
1.1       pearu      51: from distutils import sysconfig
                     52: save_init_posix = sysconfig._init_posix
                     53: def my_init_posix():
                     54:     save_init_posix()
                     55:     g = sysconfig._config_vars
1.3       pearu      56:     if g['LDSHARED'][:3]=='gcc':
                     57:         print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
                     58:         g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
                     59:         print 'to',`g['LDSHARED']`
1.1       pearu      60: sysconfig._init_posix = my_init_posix
                     61: 
1.16      pearu      62: #+++++++++++++++++ PyGiNaC version ++++++++++++++
                     63: 
1.28      pearu      64: wrapper_dir = 'wrappers3'
                     65: lib_dir = 'lib3'
                     66: 
1.16      pearu      67: major_version = 0
1.30      pearu      68: minor_version = 5
1.16      pearu      69: try: execfile(os.path.join('tools','get_revision.py'))
                     70: except: revision_version = 0
                     71: version='%d.%d.%d'%(major_version,minor_version,revision_version)
                     72: 
                     73: #++++++++++++++++ ginac._ginac +++++++++++++++++++++
1.1       pearu      74: 
1.28      pearu      75: ex_src = [
                     76:     os.path.join(wrapper_dir,'ginac_enhancements.cpp'),
                     77:     os.path.join(wrapper_dir,'ex_py.cpp'),
                     78:     os.path.join(wrapper_dir,'python_repr.cpp'),
                     79:     os.path.join(wrapper_dir,'python_str.cpp'),
1.29      pearu      80:     os.path.join(wrapper_dir,'python_csrc.cpp'),
1.28      pearu      81:     os.path.join(wrapper_dir,'pyfunc.cpp'),
                     82:     os.path.join(wrapper_dir,'slice.c'),
                     83:     ]
1.25      pearu      84: 
                     85: if gentest:
1.28      pearu      86:     fon = os.path.join(lib_dir,'doc','__init__.py')
1.25      pearu      87:     if gentest==2:
1.28      pearu      88:         os.system('%s %s -v'%(sys.executable,fon))
                     89:     elif gentest==1:
                     90:         os.system('%s %s'%(sys.executable,fon))
1.25      pearu      91: 
                     92: if len(sys.argv)==1:
                     93:     print "PyGiNaC Version",version
                     94:     sys.exit()
1.4       pearu      95: 
1.15      pearu      96: ginac_ext = Extension('ginac._ginac',
1.28      pearu      97:                       sources=ex_src+bpl_src,
1.25      pearu      98:                       include_dirs=[boost_dir,wrapper_dir],
1.6       pearu      99:                       libraries=['ginac','cln'],
1.28      pearu     100: # Add here the paths to the location
                    101: # of ginac and cln libraries:
                    102:                       library_dirs=[], 
1.21      pearu     103:                       )
1.1       pearu     104: 
                    105: #++++++++++++++++++++ setup +++++++++++++++++++++
                    106: 
                    107: setup (name = "PyGiNaC",
1.15      pearu     108:        version = version,
1.28      pearu     109:        description = "PyGiNaC --- Python Interface to GiNaC",
1.1       pearu     110:        author = "Pearu Peterson",
                    111:        author_email = "pearu@cens.ioc.ee",
1.16      pearu     112:        maintainer = "Pearu Peterson",
                    113:        maintainer_email = "pearu@cens.ioc.ee",
1.1       pearu     114:        licence = "LGPL",
1.15      pearu     115:        long_description= """
                    116: GiNaC is an open framework for symbolic computation within the C++
                    117: programming language (http://www.ginac.de/).
1.28      pearu     118: PyGiNaC is a Python extension package that provides
                    119: an interface to the GiNaC library.
1.15      pearu     120: """,
                    121:        url = "http://cens.ioc.ee/projects/pyginac/",
1.1       pearu     122:        ext_modules = [ ginac_ext ],
1.23      pearu     123:        packages = ['ginac','ginac.doc'],
1.28      pearu     124:        package_dir = {'ginac': lib_dir,
                    125:                       'ginac.doc':os.path.join(lib_dir,'doc') },
1.1       pearu     126:        )
1.15      pearu     127: 
                    128: print "PyGiNaC Version",version

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