xref: /petsc/config/configure.py (revision 9c8c10412afa6bdff9353ec41453bdbdbced64e2)
1#!/usr/bin/env python
2import os
3import sys
4
5def petsc_configure(configure_options):
6  # Should be run from the toplevel or from ./config
7  pythonDir = os.path.abspath(os.path.join('..', 'python'))
8  if not os.path.exists(pythonDir):
9    pythonDir = os.path.abspath(os.path.join('python'))
10    if not os.path.exists(pythonDir):
11      raise RuntimeError('Run configure from $PETSC_DIR, not '+os.path.abspath('.'))
12  sys.path.insert(0, os.path.join(pythonDir, 'BuildSystem'))
13  sys.path.insert(0, pythonDir)
14  print sys.path
15  try:
16    import config.framework
17  except ImportError:
18    sys.exit('''Could not locate BuildSystem in $PETSC_DIR/python.
19    You can download this package using "bk clone bk://sidl.bkbits.net/BuildSystem $PETSC_DIR/python/BuildSystem"''')
20  framework = config.framework.Framework(sys.argv[1:]+['-configModules=PETSc.Configure']+configure_options)
21  framework.argDB['CPPFLAGS'] = ''
22  framework.argDB['LIBS'] = ''
23  framework.configure()
24  #framework.dumpSubstitutions()
25
26if __name__ == '__main__':
27  petsc_configure([])
28