Diff for /python/pyGiNaC/setup.py between versions 1.4 and 1.25

version 1.4, 2001/03/15 13:48:35 version 1.25, 2001/04/17 22:39:25
Line 1 Line 1
 #!/usr/bin/env python  #!/usr/bin/env python
   #
   #   Setup file for building/installing PyGiNaC
   #
   # Requirements:
   #   Python 2.0 or higher (http://www.python.org/)
   #   GiNaC 0.8.0 or higher (http://www.ginac.de/)
   #     For GiNaC, you'll need CLN 1.1 (http://clisp.cons.org/~haible/packages-cln.html)
   #       Optional, but recommended, CLN can use GMP 3.1.1 (http://www.swox.com/gmp/)
   #   Boost 1.21.1 or higher (http://www.boost.org/)
   #  
   # Usage:
   #   > python setup.py doc install  # this will generate ginac.doc, builds _ginac
   #                                  # and installs the package.
   #   > python setup.py test -v      # this will generate and run test/test_dt.py
   #
   # In Python `import ginac'. Module `ginac' extension classes exposing
   # almost all GiNaC classes to Python.
   # See GiNaC documentation (http://www.ginac.de/tutorial/) for usage.
   #
   # Notes:
   # 1. Compilation of PyGiNaC requires more than 160MB memory (with gcc -O2
   #   on Intel Linux). However, if you don't need all the GiNaC classes
   #   to be exposed to Python, you can edit the list `wrap_input' below
   #   to indicate your needs, this will decrease also the memory consumption
   #   during the compilation. You don't need to worry about class dependencies
   #   they are solved automatically. After you edit `wrap_input', run
   #  > python setup.py reinstall
   #
   # Pearu Peterson <pearu@cens.ioc.ee>
   # 30 March 2001
   
   __credits__ = """\
   GiNaC people (www.ginac.de), for the GiNaC library.
   Boost.Python people (www.boost.org), for BPL that considerably
   simplified the wrapping of GiNaC C++ classes to Python.
   """
   
 import sys,os,string,time  import sys,os,string,time
   
   #++++++++++++++ Require Python 2.x +++++++++++++
   
 if eval(sys.version[0])<2:  if eval(sys.version[0])<2:
     print "You'll need Python 2.0 or higher to build PyGiNaC"      print "You'll need Python 2.0 or higher to build PyGiNaC"
     sys.exit()      sys.exit()
   
   #++++++++++++++ Rebuild ++++++++++++++++++++++++
   rebuild = 0
   gendoc = 0
   gentest = 0
   disable_opt = 0 # set 0 for final compilation
   
   if 'test' in sys.argv:
       i = sys.argv.index('test')
       gentest = 1
       if len(sys.argv)>i+1 and sys.argv[i+1]=='-v':
           gentest = 2
           del sys.argv[i+1]
       del sys.argv[i]
   if 'doc' in sys.argv:
       del sys.argv[sys.argv.index('doc')]
       gendoc = 1
   
   if 'rebuild' in sys.argv:
       sys.argv[sys.argv.index('rebuild')] = 'build'
       rebuild = 1
   if 'reinstall' in sys.argv:
       sys.argv[sys.argv.index('reinstall')] = 'install'
       rebuild = 1
   
   wrap_input = ['symbol','numeric','constant','relational',
                 'lst','idx','varidx','power','add','mul',
                 'ncmul','pseries','matrix','function','inifcns',
                 'function','flags','exvector',
                 'indexed','color','clifford','tensor']
   
   wrap_input = ['symbol','numeric','constant','relational',
                 'lst','power','add','mul',
                 'ncmul','pseries','matrix','function','inifcns',
                 'function','flags','exvector']
   
   #wrap_input += ['indexed','color','clifford','tensor']
   
   #wrap_input = ['function','inifcns']
   #wrap_input = ['add','mul','power','lst','pseries','relational','matrix','numeric','constant','symbol','varidx']
   #wrap_input = ['symbol','function']
   #wrap_input = ['symbol','tensor']
   #wrap_input = ['symbol','add','mul','lst','numeric','power']
   
   #++++++++++++++++ Parameters ++++++++++++++++
   nof_lst_params = 10   # max 15 for ginac, max 10 for boost.python, min 1
   nof_ncmul_params = 6  # max 6
   nof_function_params = 9 # max 13 for ginac, max 9 for boost.python, min 1
 #++++++++++++++++++++ boost +++++++++++++++++++++  #++++++++++++++++++++ boost +++++++++++++++++++++
 boost_dir = '/home/pearu/cvs/boost'  
 boost_dir = '/usr/local/share/boost'  boost_dir = '/usr/local/share/boost'
   
 bpl_dir = os.path.join(boost_dir,'libs/python/src')  if not os.path.isdir(boost_dir):
       print 'boost_dir=%s must be existing directory.'%(`boost_dir`)
       print 'Get Boost from http://www.boost.org/ and fix its path in setup.py'
       sys.exit()
   
   bpl_dir = os.path.join(boost_dir,'libs','python','src')
 bpl_src = map(lambda f:os.path.join(bpl_dir,f),  bpl_src = map(lambda f:os.path.join(bpl_dir,f),
               ['classes.cpp','conversions.cpp','extension_class.cpp',                ['classes.cpp','conversions.cpp','extension_class.cpp',
                'functions.cpp','init_function.cpp','module_builder.cpp',                 'functions.cpp','init_function.cpp','module_builder.cpp',
                'objects.cpp','types.cpp'])                 'objects.cpp','types.cpp'])
   
 #++++++++++++++++++++ GiNaC +++++++++++++++++++++  
   
 #ginac = '/usr/local'  
   
 #ginac_lib =   
   
   
 #++++++++++++++++++++++++++++++++++++++++++++++++  #++++++++++++++++++++++++++++++++++++++++++++++++
 from distutils.core import setup, Extension  from distutils.core import setup, Extension
   
 #+++++++++++++ replace gcc with g++ +++++++++++++  #+++HACK: replace linker gcc with g++ +++++++++++
 from distutils import sysconfig  from distutils import sysconfig
 save_init_posix = sysconfig._init_posix  save_init_posix = sysconfig._init_posix
 def my_init_posix():  def my_init_posix():
Line 36  def my_init_posix(): Line 119  def my_init_posix():
         print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,          print 'my_init_posix: changing LDSHARED =',`g['LDSHARED']`,
         g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]          g['LDSHARED'] = 'g++'+g['LDSHARED'][3:]
         print 'to',`g['LDSHARED']`          print 'to',`g['LDSHARED']`
       if disable_opt and g['OPT'][:6]=='-g -O2':
           print 'my_init_posix: changing OPT =',`g['OPT']`,
           g['OPT'] = '-g'+g['OPT'][6:]
           print 'to',`g['OPT']`
 sysconfig._init_posix = my_init_posix  sysconfig._init_posix = my_init_posix
   
 #++++++++++++++++++++ GiNaC._ginac +++++++++++++++++++++  #+++++++++++++++++ PyGiNaC version ++++++++++++++
   
 cppsrc = [os.path.join('src','_ginac.cpp')]  
 cppsrc = [os.path.join('tools','wrappers','ginac.cpp')]  
   
 ginac_ext = Extension('GiNaC._ginac',  major_version = 0
                      sources=cppsrc+bpl_src,  minor_version = 2
                      include_dirs=[boost_dir],  try: execfile(os.path.join('tools','get_revision.py'))
                      libraries=['cln','ginac'],  except: revision_version = 0
                      library_dirs=[]  version='%d.%d.%d'%(major_version,minor_version,revision_version)
                      )  
   #++++++++++++++++ ginac._ginac +++++++++++++++++++++
   
   ginac_cpp = os.path.join('src','_ginac.cpp')
   wrapper_dir = 'wrappers'
   
   cppsrc = [os.path.join(wrapper_dir,'ginac_enhancements.cpp'),
             os.path.join(wrapper_dir,'slice.c'),
             ginac_cpp,
             os.path.join(wrapper_dir,'python_repr.cpp'),
             os.path.join(wrapper_dir,'python_str.cpp'),
             ]
   
   
   execfile(os.path.join(wrapper_dir,'build.py'))
   
   if gendoc:
       build_ginac_cpp(wrap_input,ginac_cpp,wrapper_dir,onlydoc=1,onlytest=0,
                       vers=version,credits=__credits__)
   
   if gentest:
       build_ginac_cpp(wrap_input,ginac_cpp,wrapper_dir,onlytest=1)
       if gentest==2:
           os.system('%s %s -v'%(sys.executable,os.path.join('test','test_dt.py')))
       else:
           os.system('%s %s'%(sys.executable,os.path.join('test','test_dt.py')))
   
   if len(sys.argv)==1:
       print "PyGiNaC Version",version
       sys.exit()
   if rebuild or not os.path.exists(ginac_cpp):
       build_ginac_cpp(wrap_input,ginac_cpp,wrapper_dir,onlydoc=0,onlytest=0,
                       vers=version,credits=__credits__)
   
   ginac_ext = Extension('ginac._ginac',
                         sources=cppsrc+bpl_src,
                         include_dirs=[boost_dir,wrapper_dir],
                         libraries=['ginac','cln'],
                         library_dirs=[],
                         define_macros=[
   #    ('DEBUG_PYGINAC', None),
       ],
                         )
   
 #++++++++++++++++++++ setup +++++++++++++++++++++  #++++++++++++++++++++ setup +++++++++++++++++++++
   
 setup (name = "PyGiNaC",  setup (name = "PyGiNaC",
        version = "0.0.0",         version = version,
        description = "",         description = "PyGiNaC --- the wrapper of C++ library GiNaC to Python",
        author = "Pearu Peterson",         author = "Pearu Peterson",
        author_email = "pearu@cens.ioc.ee",         author_email = "pearu@cens.ioc.ee",
          maintainer = "Pearu Peterson",
          maintainer_email = "pearu@cens.ioc.ee",
        licence = "LGPL",         licence = "LGPL",
        long_description= "",         long_description= """
        url = "",  GiNaC is an open framework for symbolic computation within the C++
   programming language (http://www.ginac.de/).
   PyGiNaC is a Python package that provides a transparent interface
   to GiNaC library. Currently the following GiNaC classes are exposed:
     ex, symbol, numeric, constant, relational, add, mul, power, ncmul,
     matrix, pseries, function, idx, varidx, tensor, indexed,
     lst, exvector, expair, exlist, epvector, etc.
   In addition, PyGiNaC provides wrappers for various elementary functions,
   such as sin, factorial, etc.
   """,
          url = "http://cens.ioc.ee/projects/pyginac/",
        ext_modules = [ ginac_ext ],         ext_modules = [ ginac_ext ],
        packages = ['GiNaC'],         packages = ['ginac','ginac.doc'],
        package_dir = {'GiNaC': 'lib'},         package_dir = {'ginac': 'lib',
                         'ginac.doc':os.path.join('lib','doc') },
        )         )
   
   print "PyGiNaC Version",version

Removed from v.1.4  
changed lines
  Added in v.1.25


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