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