xref: /petsc/config/configure.py (revision e831869d00a6b6bf5bd64f1ce9662fca56500707)
1#!/usr/bin/env python
2from __future__ import print_function
3import os, sys
4
5extraLogs     = []
6petsc_arch    = ''
7banner_length = 93
8
9# Use en_US as language so that BuildSystem parses compiler messages in english
10def fixLang(lang):
11  if lang in os.environ and os.environ[lang] != '':
12    lv = os.environ[lang]
13    enc = ''
14    try: lv,enc = lv.split('.')
15    except: pass
16    if lv not in ['en_US','C']: lv = 'en_US'
17    if enc: lv = lv+'.'+enc
18    os.environ[lang] = lv
19
20fixLang('LC_LOCAL')
21fixLang('LANG')
22
23
24def check_for_option_mistakes(opts):
25  for opt in opts[1:]:
26    name = opt.split('=')[0]
27    if name.find(' ') >= 0:
28      raise ValueError('The option "'+name+'" has a space character in the name - this is likely incorrect usage.');
29    if name.find('_') >= 0:
30      exception = False
31      for exc in ['mkl_sparse', 'mkl_sparse_optimize', 'mkl_cpardiso', 'mkl_pardiso', 'superlu_dist', 'PETSC_ARCH', 'PETSC_DIR', 'CXX_CXXFLAGS', 'LD_SHARED', 'CC_LINKER_FLAGS', 'CXX_LINKER_FLAGS', 'FC_LINKER_FLAGS', 'AR_FLAGS', 'C_VERSION', 'CXX_VERSION', 'FC_VERSION', 'size_t', 'MPI_Comm','MPI_Fint','int64_t']:
32        if name.find(exc) >= 0:
33          exception = True
34      if not exception:
35        raise ValueError('The option '+name+' should probably be '+name.replace('_', '-'));
36    if opt.find('=') >=0:
37      optval = opt.split('=')[1]
38      if optval == 'ifneeded':
39        raise ValueError('The option '+opt+' should probably be '+opt.replace('ifneeded', '1'));
40    for exc in ['mkl_sparse', 'mkl_sparse_optimize', 'mkl_cpardiso', 'mkl_pardiso', 'superlu_dist']:
41      if name.find(exc.replace('_','-')) > -1:
42        raise ValueError('The option '+opt+' should be '+opt.replace(exc.replace('_','-'),exc));
43  return
44
45def check_for_unsupported_combinations(opts):
46  if '--with-precision=single' in opts and '--with-clanguage=cxx' in opts and '--with-scalar-type=complex' in opts:
47    sys.exit(ValueError('PETSc does not support single precision complex with C++ clanguage, run with --with-clanguage=c'))
48
49def check_for_option_changed(opts):
50# Document changes in command line options here.
51  optMap = [('with-64bit-indices','with-64-bit-indices'),
52            ('with-mpi-exec','with-mpiexec'),
53            ('c-blas-lapack','f2cblaslapack'),
54            ('cholmod','suitesparse'),
55            ('umfpack','suitesparse'),
56            ('matlabengine','matlab-engine'),
57            ('sundials','sundials2'),
58            ('f-blas-lapack','fblaslapack'),
59            ('with-packages-dir','with-packages-download-dir'),
60            ('with-external-packages-dir','with-packages-build-dir'),
61            ('package-dirs','with-packages-search-path'),
62            ('download-petsc4py-python','with-python-exec'),
63            ('search-dirs','with-executables-search-path')]
64  for opt in opts[1:]:
65    optname = opt.split('=')[0].strip('-')
66    for oldname,newname in optMap:
67      if optname.find(oldname) >=0 and not optname.find(newname) >=0:
68        raise ValueError('The option '+opt+' should probably be '+opt.replace(oldname,newname))
69  return
70
71def check_petsc_arch(opts):
72  # If PETSC_ARCH not specified - use script name (if not configure.py)
73  global petsc_arch
74  found = 0
75  for name in opts:
76    if name.find('PETSC_ARCH=') >= 0:
77      petsc_arch=name.split('=')[1]
78      found = 1
79      break
80  # If not yet specified - use the filename of script
81  if not found:
82      filename = os.path.basename(sys.argv[0])
83      if not filename.startswith('configure') and not filename.startswith('reconfigure') and not filename.startswith('setup'):
84        petsc_arch=os.path.splitext(os.path.basename(sys.argv[0]))[0]
85        useName = 'PETSC_ARCH='+petsc_arch
86        opts.append(useName)
87  return 0
88
89def chkenable():
90  #Replace all 'enable-'/'disable-' with 'with-'=0/1/tail
91  #enable-fortran is a special case, the resulting --with-fortran is ambiguous.
92  #Would it mean --with-fc=
93  en_dash = u'\N{EN DASH}'
94  no_break_space = u'\N{NO-BREAK SPACE}'
95  if sys.version_info < (3, 0):
96    en_dash = en_dash.encode('utf-8')
97    no_break_space = no_break_space.encode('utf-8')
98
99  for l in range(0,len(sys.argv)):
100    name = sys.argv[l]
101    if name.find(no_break_space) >= 0:
102      sys.exit(ValueError('Unicode NO-BREAK SPACE char found in arguments! Please rerun configure using regular space chars: %s' % [name]))
103    name = name.replace(en_dash,'-')
104    if name.lstrip('-').startswith('enable-cxx'):
105      if name.find('=') == -1:
106        name = name.replace('enable-cxx','with-clanguage=C++',1)
107      else:
108        head, tail = name.split('=', 1)
109        if tail=='0':
110          name = head.replace('enable-cxx','with-clanguage=C',1)
111        else:
112          name = head.replace('enable-cxx','with-clanguage=C++',1)
113      sys.argv[l] = name
114      continue
115    if name.lstrip('-').startswith('disable-cxx'):
116      if name.find('=') == -1:
117        name = name.replace('disable-cxx','with-clanguage=C',1)
118      else:
119        head, tail = name.split('=', 1)
120        if tail == '0':
121          name = head.replace('disable-cxx','with-clanguage=C++',1)
122        else:
123          name = head.replace('disable-cxx','with-clanguage=C',1)
124      sys.argv[l] = name
125      continue
126
127    if name.lstrip('-').startswith('enable-'):
128      if name.find('=') == -1:
129        name = name.replace('enable-','with-',1)+'=1'
130      else:
131        head, tail = name.split('=', 1)
132        name = head.replace('enable-','with-',1)+'='+tail
133    if name.lstrip('-').startswith('disable-'):
134      if name.find('=') == -1:
135        name = name.replace('disable-','with-',1)+'=0'
136      else:
137        head, tail = name.split('=', 1)
138        if tail == '1': tail = '0'
139        name = head.replace('disable-','with-',1)+'='+tail
140    if name.lstrip('-').startswith('without-'):
141      if name.find('=') == -1:
142        name = name.replace('without-','with-',1)+'=0'
143      else:
144        head, tail = name.split('=', 1)
145        if tail == '1': tail = '0'
146        name = head.replace('without-','with-',1)+'='+tail
147    sys.argv[l] = name
148
149def chksynonyms():
150  #replace common configure options with ones that PETSc BuildSystem recognizes
151  simplereplacements = {'F77' : 'FC', 'F90' : 'FC'}
152  for l in range(0,len(sys.argv)):
153    name = sys.argv[l]
154
155    name = name.replace('download-petsc4py','with-petsc4py')
156    name = name.replace('with-openmpi','with-mpi')
157    name = name.replace('with-mpich','with-mpi')
158    name = name.replace('with-blas-lapack','with-blaslapack')
159    name = name.replace('with-cuda-gencodearch','with-cuda-arch')
160
161    if name.find('with-debug=') >= 0 or name.endswith('with-debug'):
162      if name.find('=') == -1:
163        name = name.replace('with-debug','with-debugging')+'=1'
164      else:
165        head, tail = name.split('=', 1)
166        name = head.replace('with-debug','with-debugging')+'='+tail
167
168    if name.find('with-shared=') >= 0 or name.endswith('with-shared'):
169      if name.find('=') == -1:
170        name = name.replace('with-shared','with-shared-libraries')+'=1'
171      else:
172        head, tail = name.split('=', 1)
173        name = head.replace('with-shared','with-shared-libraries')+'='+tail
174
175    if name.find('with-index-size=') >=0:
176      head,tail = name.split('=',1)
177      if int(tail)==32:
178        name = '--with-64-bit-indices=0'
179      elif int(tail)==64:
180        name = '--with-64-bit-indices=1'
181      else:
182        raise RuntimeError('--with-index-size= must be 32 or 64')
183
184    if name.find('with-precision=') >=0:
185      head,tail = name.split('=',1)
186      if tail.find('quad')>=0:
187        name='--with-precision=__float128'
188
189    for i,j in simplereplacements.items():
190      if name.find(i+'=') >= 0:
191        name = name.replace(i+'=',j+'=')
192      elif name.find('with-'+i.lower()+'=') >= 0:
193        name = name.replace(i.lower()+'=',j.lower()+'=')
194
195    # restore 'sys.argv[l]' from the intermediate var 'name'
196    sys.argv[l] = name
197
198def chkwincompilerusinglink():
199  for arg in sys.argv:
200    if (arg.find('win32fe') >= 0 and (arg.find('f90') >=0 or arg.find('ifort') >=0 or arg.find('icl') >=0)):
201      return 1
202  return 0
203
204def chkdosfiles():
205  # cygwin - but not a hg clone - so check one of files in bin dir
206  if b"\r\n" in open(os.path.join('lib','petsc','bin','petscmpiexec'),"rb").read():
207    print('===============================================================================')
208    print(' *** Scripts are in DOS mode. Was winzip used to extract petsc sources?    ****')
209    print(' *** Please restart with a fresh tarball and use "tar -xzf petsc.tar.gz"   ****')
210    print('===============================================================================')
211    sys.exit(3)
212  return
213
214def chkcygwinlink():
215  if os.path.exists('/usr/bin/cygcheck.exe') and os.path.exists('/usr/bin/link.exe') and chkwincompilerusinglink():
216      if '--ignore-cygwin-link' in sys.argv: return 0
217      print('===============================================================================')
218      print(' *** Cygwin /usr/bin/link detected! Compiles with Intel icl/ifort can break!  **')
219      print(' *** To workaround do: "mv /usr/bin/link.exe /usr/bin/link-cygwin.exe"     **')
220      print(' *** Or to ignore this check, use configure option: --ignore-cygwin-link. But compiles can fail. **')
221      print('===============================================================================')
222      sys.exit(3)
223  return 0
224
225def chkbrokencygwin():
226  if os.path.exists('/usr/bin/cygcheck.exe'):
227    buf = os.popen('/usr/bin/cygcheck.exe -c cygwin').read()
228    if buf.find('1.5.11-1') > -1:
229      print('===============================================================================')
230      print(' *** cygwin-1.5.11-1 detected. ./configure fails with this version ***')
231      print(' *** Please upgrade to cygwin-1.5.12-1 or newer version. This can  ***')
232      print(' *** be done by running cygwin-setup, selecting "next" all the way.***')
233      print('===============================================================================')
234      sys.exit(3)
235  return 0
236
237def chkusingwindowspython():
238  if sys.platform == 'win32':
239    print('===============================================================================')
240    print(' *** Windows python detected. Please rerun ./configure with cygwin-python. ***')
241    print('===============================================================================')
242    sys.exit(3)
243  return 0
244
245def chkcygwinpython():
246  if sys.platform == 'cygwin' :
247    import platform
248    import re
249    r=re.compile("([0-9]+).([0-9]+).([0-9]+)")
250    m=r.match(platform.release())
251    major=int(m.group(1))
252    minor=int(m.group(2))
253    subminor=int(m.group(3))
254    if ((major < 1) or (major == 1 and minor < 7) or (major == 1 and minor == 7 and subminor < 34)):
255      sys.argv.append('--useThreads=0')
256      extraLogs.append('''\
257===============================================================================
258** Cygwin version is older than 1.7.34. Python threads do not work correctly. ***
259** Disabling thread usage for this run of ./configure *******
260===============================================================================''')
261  return 0
262
263def chkcygwinwindowscompilers():
264  '''Adds win32fe for Microsoft/Intel compilers'''
265  if os.path.exists('/usr/bin/cygcheck.exe'):
266    for l in range(1,len(sys.argv)):
267      option = sys.argv[l]
268      for i in ['cl','icl','ifort']:
269        if option.startswith(i):
270          sys.argv[l] = 'win32fe '+option
271          break
272  return 0
273
274def chkrhl9():
275  if os.path.exists('/etc/redhat-release'):
276    try:
277      file = open('/etc/redhat-release','r')
278      buf = file.read()
279      file.close()
280    except:
281      # can't read file - assume dangerous RHL9
282      buf = 'Shrike'
283    if buf.find('Shrike') > -1:
284      sys.argv.append('--useThreads=0')
285      extraLogs.append('''\
286==============================================================================
287   *** RHL9 detected. Threads do not work correctly with this distribution ***
288   ****** Disabling thread usage for this run of ./configure *********
289===============================================================================''')
290  return 0
291
292def chktmpnoexec():
293  if not hasattr(os,'ST_NOEXEC'): return # novermin
294  if 'TMPDIR' in os.environ: tmpDir = os.environ['TMPDIR']
295  else: tmpDir = '/tmp'
296  if os.statvfs(tmpDir).f_flag & os.ST_NOEXEC: # novermin
297    if os.statvfs(os.path.abspath('.')).f_flag & os.ST_NOEXEC: # novermin
298      print('************************************************************************')
299      print('* TMPDIR '+tmpDir+' has noexec attribute. Same with '+os.path.abspath('.')+' where petsc is built.')
300      print('* Suggest building PETSc in a location without this restriction!')
301      print('* Alternatively, set env variable TMPDIR to a location that is not restricted to run binaries.')
302      print('************************************************************************')
303      sys.exit(4)
304    else:
305      newTmp = os.path.abspath('tmp-petsc')
306      print('************************************************************************')
307      print('* TMPDIR '+tmpDir+' has noexec attribute. Using '+newTmp+' instead.')
308      print('************************************************************************')
309      if not os.path.isdir(newTmp): os.mkdir(os.path.abspath(newTmp))
310      os.environ['TMPDIR'] = newTmp
311  return
312
313def check_cray_modules():
314  import script
315  '''For Cray systems check if the cc, CC, ftn compiler suite modules have been set'''
316  cray = os.getenv('CRAY_SITE_LIST_DIR')
317  if not cray: return
318  cray = os.getenv('CRAYPE_DIR')
319  if not cray:
320   print('************************************************************************')
321   print('* You are on a Cray system but no programming environments have been loaded')
322   print('* Perhaps you need:')
323   print('*       module load intel ; module load PrgEnv-intel')
324   print('*   or  module load PrgEnv-cray')
325   print('*   or  module load PrgEnv-gnu')
326   print('* See https://petsc.org/release/install/install/#installing-on-large-scale-doe-systems')
327   print('************************************************************************')
328   sys.exit(4)
329
330def check_broken_configure_log_links():
331  '''Sometime symlinks can get broken if the original files are deleted. Delete such broken links'''
332  import os
333  for logfile in ['configure.log','configure.log.bkp']:
334    if os.path.islink(logfile) and not os.path.isfile(logfile): os.remove(logfile)
335  return
336
337def move_configure_log(framework):
338  '''Move configure.log to PETSC_ARCH/lib/petsc/conf - and update configure.log.bkp in both locations appropriately'''
339  global petsc_arch
340
341  if hasattr(framework,'arch'): petsc_arch = framework.arch
342  if hasattr(framework,'logName'): curr_file = framework.logName
343  else: curr_file = 'configure.log'
344
345  if petsc_arch:
346    import shutil
347    import os
348
349    # Just in case - confdir is not created
350    lib_dir = os.path.join(petsc_arch,'lib')
351    petsc_dir = os.path.join(petsc_arch,'lib','petsc')
352    conf_dir = os.path.join(petsc_arch,'lib','petsc','conf')
353    if not os.path.isdir(petsc_arch): os.mkdir(petsc_arch)
354    if not os.path.isdir(lib_dir): os.mkdir(lib_dir)
355    if not os.path.isdir(petsc_dir): os.mkdir(petsc_dir)
356    if not os.path.isdir(conf_dir): os.mkdir(conf_dir)
357
358    curr_bkp  = curr_file + '.bkp'
359    new_file  = os.path.join(conf_dir,curr_file)
360    new_bkp   = new_file + '.bkp'
361
362    # Keep backup in $PETSC_ARCH/lib/petsc/conf location
363    if os.path.isfile(new_bkp): os.remove(new_bkp)
364    if os.path.isfile(new_file): os.rename(new_file,new_bkp)
365    if os.path.isfile(curr_file):
366      shutil.copyfile(curr_file,new_file)
367      os.remove(curr_file)
368    if os.path.isfile(new_file): os.symlink(new_file,curr_file)
369    # If the old bkp is using the same PETSC_ARCH/lib/petsc/conf - then update bkp link
370    if os.path.realpath(curr_bkp) == os.path.realpath(new_file):
371      if os.path.isfile(curr_bkp): os.remove(curr_bkp)
372      if os.path.isfile(new_bkp): os.symlink(new_bkp,curr_bkp)
373  return
374
375def print_final_timestamp(framework):
376  import time
377  framework.log.write(('='*80)+'\n')
378  framework.log.write('Finishing configure run at '+time.strftime('%a, %d %b %Y %H:%M:%S %z')+'\n')
379  framework.log.write(('='*80)+'\n')
380  return
381
382def petsc_configure(configure_options):
383  if 'PETSC_DIR' in os.environ:
384    petscdir = os.environ['PETSC_DIR']
385    if petscdir.find(' ') > -1:
386      raise RuntimeError('Your PETSC_DIR '+petscdir+' has spaces in it; this is not allowed.\n Change the directory with PETSc to not have spaces in it')
387    if not os.path.isabs(petscdir):
388      raise RuntimeError('PETSC_DIR ("'+petscdir+'") is set as a relative path. It must be set as an absolute path.')
389
390    try:
391      sys.path.append(os.path.join(petscdir,'lib','petsc','bin'))
392      import petscnagupgrade
393      file     = os.path.join(petscdir,'.nagged')
394      if not petscnagupgrade.naggedtoday(file):
395        petscnagupgrade.currentversion(petscdir)
396    except:
397      pass
398  banner_line = banner_length*'='
399  print(banner_line)
400  print('Configuring PETSc to compile on your system'.center(banner_length))
401  print(banner_line)
402
403  try:
404    # Command line arguments take precedence (but don't destroy argv[0])
405    sys.argv = sys.argv[:1] + configure_options + sys.argv[1:]
406    check_for_option_mistakes(sys.argv)
407    check_for_option_changed(sys.argv)
408  except (TypeError, ValueError) as e:
409    emsg = str(e)
410    if not emsg.endswith('\n'): emsg = emsg+'\n'
411    banner_line = banner_length*'*'
412    msg = '\n'.join([
413      banner_line,
414      'ERROR in COMMAND LINE ARGUMENT to ./configure'.center(banner_length),
415      banner_length*'-',
416      emsg,
417      banner_line,
418      '' # to add an additional newline at the end
419    ])
420    sys.exit(msg)
421  # check PETSC_ARCH
422  check_for_unsupported_combinations(sys.argv)
423  check_petsc_arch(sys.argv)
424  check_broken_configure_log_links()
425
426  #rename '--enable-' to '--with-'
427  chkenable()
428  # support a few standard configure option types
429  chksynonyms()
430  # Check for broken cygwin
431  chkbrokencygwin()
432  # Disable threads on RHL9
433  chkrhl9()
434  # Make sure cygwin-python is used on windows
435  chkusingwindowspython()
436  # Threads don't work for cygwin & python...
437  chkcygwinpython()
438  chkcygwinlink()
439  chkdosfiles()
440  chkcygwinwindowscompilers()
441  chktmpnoexec()
442
443  for l in range(1,len(sys.argv)):
444    if sys.argv[l].startswith('--with-fc=') and sys.argv[l].endswith('nagfor'):
445      # need a way to save this value and later CC so that petscnagfor may use them
446      name = sys.argv[l].split('=')[1]
447      sys.argv[l] = '--with-fc='+os.path.join(os.path.abspath('.'),'lib','petsc','bin','petscnagfor')
448      break
449
450
451  # Should be run from the toplevel
452  configDir = os.path.abspath('config')
453  bsDir     = os.path.join(configDir, 'BuildSystem')
454  if not os.path.isdir(configDir):
455    raise RuntimeError('Run configure from $PETSC_DIR, not '+os.path.abspath('.'))
456  sys.path.insert(0, bsDir)
457  sys.path.insert(0, configDir)
458  import config.base
459  import config.framework
460  import pickle
461  import traceback
462
463  # Check Cray without modules
464  check_cray_modules()
465
466  tbo = None
467  framework = None
468  try:
469    framework = config.framework.Framework(['--configModules=PETSc.Configure','--optionsModule=config.compilerOptions']+sys.argv[1:], loadArgDB = 0)
470    framework.setup()
471    framework.logPrint('\n'.join(extraLogs))
472    framework.configure(out = sys.stdout)
473    framework.storeSubstitutions(framework.argDB)
474    framework.argDB['configureCache'] = pickle.dumps(framework)
475    framework.printSummary()
476    framework.argDB.save(force = True)
477    framework.logClear()
478    print_final_timestamp(framework)
479    framework.closeLog()
480    try:
481      move_configure_log(framework)
482    except:
483      # perhaps print an error about unable to shuffle logs?
484      pass
485    return 0
486  except (RuntimeError, config.base.ConfigureSetupError) as e:
487    tbo = sys.exc_info()[2]
488    emsg = str(e)
489    if not emsg.endswith('\n'): emsg = emsg+'\n'
490    msg ='*******************************************************************************\n'\
491    +'         UNABLE to CONFIGURE with GIVEN OPTIONS    (see configure.log for details):\n' \
492    +'-------------------------------------------------------------------------------\n'  \
493    +emsg+'*******************************************************************************\n'
494    se = ''
495  except (TypeError, ValueError) as e:
496    # this exception is automatically deleted by Python so we need to save it to print below
497    tbo = sys.exc_info()[2]
498    emsg = str(e)
499    if not emsg.endswith('\n'): emsg = emsg+'\n'
500    msg ='*******************************************************************************\n'\
501    +'    TypeError or ValueError possibly related to ERROR in COMMAND LINE ARGUMENT while running ./configure \n' \
502    +'-------------------------------------------------------------------------------\n'  \
503    +emsg+'*******************************************************************************\n'
504    se = ''
505  except ImportError as e :
506    # this exception is automatically deleted by Python so we need to save it to print below
507    tbo = sys.exc_info()[2]
508    emsg = str(e)
509    if not emsg.endswith('\n'): emsg = emsg+'\n'
510    msg ='*******************************************************************************\n'\
511    +'                     ImportError while runing ./configure \n' \
512    +'-------------------------------------------------------------------------------\n'  \
513    +emsg+'*******************************************************************************\n'
514    se = ''
515  except OSError as e :
516    tbo = sys.exc_info()[2]
517    emsg = str(e)
518    if not emsg.endswith('\n'): emsg = emsg+'\n'
519    msg ='*******************************************************************************\n'\
520    +'                    OSError while running ./configure \n' \
521    +'-------------------------------------------------------------------------------\n'  \
522    +emsg+'*******************************************************************************\n'
523    se = ''
524  except SystemExit as e:
525    tbo = sys.exc_info()[2]
526    if e.code is None or e.code == 0:
527      return
528    if e.code == 10:
529      sys.exit(10)
530    msg ='*******************************************************************************\n'\
531    +'         CONFIGURATION FAILURE  (Please send configure.log to petsc-maint@mcs.anl.gov)\n' \
532    +'*******************************************************************************\n'
533    se  = str(e)
534  except Exception as e:
535    tbo = sys.exc_info()[2]
536    msg ='*******************************************************************************\n'\
537    +'        CONFIGURATION CRASH  (Please send configure.log to petsc-maint@mcs.anl.gov)\n' \
538    +'*******************************************************************************\n'
539    se  = str(e)
540
541  print(msg)
542  if not framework is None:
543    framework.logClear()
544    if hasattr(framework, 'log'):
545      try:
546        if hasattr(framework,'compilerDefines'):
547          framework.log.write('**** Configure header '+framework.compilerDefines+' ****\n')
548          framework.outputHeader(framework.log)
549        if hasattr(framework,'compilerFixes'):
550          framework.log.write('**** C specific Configure header '+framework.compilerFixes+' ****\n')
551          framework.outputCHeader(framework.log)
552      except Exception as e:
553        framework.log.write('Problem writing headers to log: '+str(e))
554      try:
555        framework.log.write(msg+se)
556        traceback.print_tb(tbo, file = framework.log)
557        print_final_timestamp(framework)
558        if hasattr(framework,'log'): framework.log.close()
559        move_configure_log(framework)
560      except Exception as e:
561        print('Error printing error message from exception or printing the traceback:'+str(e))
562        traceback.print_tb(sys.exc_info()[2])
563      sys.exit(1)
564    else:
565      print(se)
566      traceback.print_tb(tbo)
567  else:
568    print(se)
569    traceback.print_tb(tbo)
570  if hasattr(framework,'log'): framework.log.close()
571
572if __name__ == '__main__':
573  petsc_configure([])
574