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