Diff for /python/pyGiNaC/setup4.py between versions 1.6 and 1.7

version 1.6, 2001/08/24 16:40:27 version 1.7, 2001/11/20 17:11:13
Line 20 Line 20
 # 23 April 2001  # 23 April 2001
 # 11 August 2001  # 11 August 2001
 # 24 August 2001  # 24 August 2001
   # 20 November 2001
   
 __credits__ = """\  __credits__ = """\
 GiNaC group (www.ginac.de), for the GiNaC library.  GiNaC group (www.ginac.de), for the GiNaC library.
Line 27  Boost.Python group (www.boost.org), for  Line 28  Boost.Python group (www.boost.org), for 
 simplified exposure of GiNaC C++ classes to Python.  simplified exposure of GiNaC C++ classes to Python.
 """  """
   
 import sys,os,string,time  import sys,os,string,time,commands,re
   
 __today__ = time.asctime(time.localtime())  __today__ = time.asctime(time.localtime())
 __author__ = 'Pearu Peterson <pearu@cens.ioc.ee>'  __author__ = 'Pearu Peterson <pearu@cens.ioc.ee>'
Line 41  print 'Python Version',sys.version.split Line 42  print 'Python Version',sys.version.split
   
 #++++++++++++++ Rebuild ++++++++++++++++++++++++  #++++++++++++++ Rebuild ++++++++++++++++++++++++
 rebuild = 0  rebuild = 0
 disable_opt = 0 # set 0 for final compilation  disable_opt = 1 # disable optimization flags, useful when debugging
                   # set 0 for final compilation
   
 if 'rebuild' in sys.argv:  if 'rebuild' in sys.argv:
     sys.argv[sys.argv.index('rebuild')] = 'build'      sys.argv[sys.argv.index('rebuild')] = 'build'
Line 50  if 'reinstall' in sys.argv: Line 52  if 'reinstall' in sys.argv:
     sys.argv[sys.argv.index('reinstall')] = 'install'      sys.argv[sys.argv.index('reinstall')] = 'install'
     rebuild = 1      rebuild = 1
   
   #+++++++++++++++++ arguments for Extension ++++++++++++++++
   libraries = []
   library_dirs = []
   extra_objects = []
   extra_link_args = []
   extra_compile_args = []
   include_dirs = [] #['tools']  # Uncomment if sstream cannot be found.
   sources = []
   
   #++++++++++++++++ GiNaC,CLN (,GMP) +++++++++++++++++++++++++++
   gmp_so = '/usr/lib/libgmp.so' # fix this path if CLN uses gmp.
   s,ginac_version=commands.getstatusoutput ('ginac-config --version')
   if not s:
       print 'GiNaC Version',ginac_version
       ginac_prefix=commands.getoutput ('ginac-config --prefix')
       ginac_so = os.path.join (ginac_prefix,'lib','libginac.so')
       if os.path.isfile(ginac_so):
           extra_objects.append (ginac_so)
           s,cln_version=commands.getstatusoutput ('cln-config --version')
           if not s:
               print 'CLN Version',cln_version
               cln_prefix = commands.getoutput ('cln-config --prefix')
               cln_so = os.path.join (cln_prefix,'lib','libcln.so')
               cln_libs = commands.getoutput ('cln-config --libs')
               if os.path.isfile (cln_so):
                   extra_objects.append(cln_so)
                   cln_libs = cln_libs.replace ('-lcln ',' ')
               if re.match (r'.*-lgmp\b',cln_libs) and os.path.isfile (gmp_so):
                   extra_objects.append(gmp_so)
                   cln_libs = cln_libs.replace ('-lgmp',' ')
               if re.match (r'.*-l',cln_libs):
                   extra_link_args.append(cln_libs)
               cln_flags = commands.getoutput ('cln-config --cppflags')
               if cln_flags:
                   extra_compile_args.append (cln_flags)
           else:
               libraries += ['cln']
               print 'Failed to establish CLN using cln-config. Using defaults.'
       else:
           extra_link_args.append (commands.getoutput ('ginac-config --libs'))
       extra_compile_args.append (commands.getoutput ('ginac-config --cppflags'))
   else:
       print 'Failed to establish GiNaC using ginac-config. Using defaults.'
       libraries += ['ginac','cln']
   
 #++++++++++++++++++++ boost.python +++++++++++++++++++++  #++++++++++++++++++++ boost.python +++++++++++++++++++++
   
 boost_dir = '/usr/local/share/boost'  # Fix this path for Boost headers
 boost_dir = 'boost'  boost_dir = 'boost'
   
 if not os.path.isdir(boost_dir):  if not os.path.isdir(boost_dir):
     print 'boost_dir=%s must be existing directory.'%(`boost_dir`)      print 'boost_dir=%s must be existing directory.'%(`boost_dir`)
     print '  Get Boost from http://www.boost.org/'      print '  Get Boost from http://www.boost.org/'
     print '  Fix its path in setup4.py'      print '  Fix its path in setup4.py'
     sys.exit()      sys.exit()
   else:
       include_dirs.append (boost_dir)
   
 bpl_dir = os.path.join(boost_dir,'libs','python','src')  try:
 bpl_src = map(lambda f:os.path.join(bpl_dir,f),      import _libboostpython
       libboost_so = _libboostpython.__file__
   except ImportError:
       s = os.system ('cd libboostpython && ./setup.py install')
       if not s:
           try:
               import _libboostpython
               libboost_so = _libboostpython.__file__
               s = 0
           except ImportError: pass
       if s:
           # Fix this path if you have your own Boost.Python shared library
           libboost_so = 'XXX/usr/lib/libboost_python.so'
   
   if not os.path.exists (libboost_so):
       print 'Using boost sources.'
       libboost = ''
       bpl_dir = os.path.join(boost_dir,'libs','python','src')
       bpl_src = map(lambda f:os.path.join(bpl_dir,f),
               ['classes.cpp',                ['classes.cpp',
                'conversions.cpp',                 'conversions.cpp',
                'extension_class.cpp',                 'extension_class.cpp',
Line 71  bpl_src = map(lambda f:os.path.join(bpl_ Line 137  bpl_src = map(lambda f:os.path.join(bpl_
                'init_function.cpp',                 'init_function.cpp',
                'module_builder.cpp',                 'module_builder.cpp',
                'objects.cpp','types.cpp'])                 'objects.cpp','types.cpp'])
       sources += bpl_src
   else:
       extra_objects.append (libboost_so)
   
 #++++++++++++++++++++++++++++++++++++++++++++++++  #++++++++++++++++++++++++++++++++++++++++++++++++
 from distutils.core import setup, Extension  from distutils.core import setup, Extension
   
 #+++HACK: replace linker gcc with g++ +++++++++++  #+++HACK: replace linker gcc with g++ +++++++++++
 #+++      turn off optimization       +++++++++++  #+++      turn off optimization if disable_opt +++++++++++
 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 100  lib_dir = 'lib%d'%edition Line 169  lib_dir = 'lib%d'%edition
 src_dir = 'src%d'%edition  src_dir = 'src%d'%edition
   
 major_version = 0  major_version = 0
 minor_version = 6  minor_version = 7
 try: execfile(os.path.join('tools','get_revision.py'))  try: execfile(os.path.join('tools','get_revision.py'))
 except: revision_version = 0  except: revision_version = 0
 version='%d.%d.%d'%(major_version,minor_version,revision_version)  version='%d.%d.%d'%(major_version,minor_version,revision_version)
Line 111  f = open(os.path.join(lib_dir,'__version Line 180  f = open(os.path.join(lib_dir,'__version
 f.write('__version__ = "%s"\n'%(version))  f.write('__version__ = "%s"\n'%(version))
 f.close()  f.close()
   
   include_dirs.append (wrapper_dir)
   
   #+++++++++++++ print summary ++++++++++++++++++
   print 'extra_link_args=',extra_link_args
   print 'extra_compile_args=',extra_compile_args
   print 'extra_objects=',extra_objects
   print 'include_dirs=',include_dirs
   print 'libraries=',libraries
   print 'sources=',sources
   if len(sys.argv)==1:
       print "PyGiNaC Version",version
       sys.exit()
 #++++++++++++++++ ginac._ginac +++++++++++++++++++++  #++++++++++++++++ ginac._ginac +++++++++++++++++++++
   
 ginac_src = []  ginac_src = []
Line 119  for n in ['_ginac.cpp', Line 200  for n in ['_ginac.cpp',
           ]:            ]:
     ginac_src.append(os.path.join(wrapper_dir,n))      ginac_src.append(os.path.join(wrapper_dir,n))
   
 if len(sys.argv)==1:  sources += ginac_src
     print "PyGiNaC Version",version  
     sys.exit()  
   
 if rebuild:  if rebuild:
     for n in ['_ginac.cpp']:      for n in ['_ginac.cpp']:
Line 130  if rebuild: Line 209  if rebuild:
         os.system('touch '+n)          os.system('touch '+n)
   
 _ginac_ext = Extension('ginac._ginac',  _ginac_ext = Extension('ginac._ginac',
                       sources=ginac_src+bpl_src,                         sources = sources,
                       include_dirs=[boost_dir,                         include_dirs = include_dirs,
                                     wrapper_dir,                         libraries = libraries,
                                     'tools',       # for sstream                         library_dirs = library_dirs,
                                     ],                         extra_objects = extra_objects,
                       libraries=['ginac','cln'],                         extra_compile_args = extra_compile_args,
                       library_dirs=[],                         extra_link_args = extra_link_args,
                       )                        )
   
 #+++++++++++++++ force rebuild ++++++++++++++++++  
   
   
 #++++++++++++++ extension modules +++++++++++++++  #++++++++++++++ extension modules +++++++++++++++
   
 ext_modules = [_ginac_ext]  ext_modules = [_ginac_ext]

Removed from v.1.6  
changed lines
  Added in v.1.7


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