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