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 try: 15 import config.framework 16 except ImportError: 17 sys.exit('''Could not locate BuildSystem in $PETSC_DIR/python. 18 You can download this package using "bk clone bk://sidl.bkbits.net/BuildSystem $PETSC_DIR/python/BuildSystem"''') 19 framework = config.framework.Framework(sys.argv[1:]+['-configModules=PETSc.Configure']+configure_options) 20 framework.argDB['CPPFLAGS'] = '' 21 framework.argDB['LIBS'] = '' 22 framework.configure() 23 #framework.dumpSubstitutions() 24 25if __name__ == '__main__': 26 petsc_configure([]) 27