15d5a5a7bSMatthew Knepley#!/usr/bin/env python 25d5a5a7bSMatthew Knepleyimport os 35d5a5a7bSMatthew Knepleyimport sys 45d5a5a7bSMatthew Knepley 52fb34ac0SMatthew Knepleyif not hasattr(sys, 'version_info'): 62fb34ac0SMatthew Knepley raise RuntimeError('You must have Python version 2.2 or higher to run configure') 72fb34ac0SMatthew Knepley 85d5a5a7bSMatthew Knepleydef petsc_configure(configure_options): 95d5a5a7bSMatthew Knepley # Should be run from the toplevel or from ./config 105d5a5a7bSMatthew Knepley pythonDir = os.path.abspath(os.path.join('..', 'python')) 115d5a5a7bSMatthew Knepley if not os.path.exists(pythonDir): 125d5a5a7bSMatthew Knepley pythonDir = os.path.abspath(os.path.join('python')) 135d5a5a7bSMatthew Knepley if not os.path.exists(pythonDir): 145d5a5a7bSMatthew Knepley raise RuntimeError('Run configure from $PETSC_DIR, not '+os.path.abspath('.')) 155d5a5a7bSMatthew Knepley sys.path.insert(0, os.path.join(pythonDir, 'BuildSystem')) 165d5a5a7bSMatthew Knepley sys.path.insert(0, pythonDir) 175d5a5a7bSMatthew Knepley try: 185d5a5a7bSMatthew Knepley import config.framework 195d5a5a7bSMatthew Knepley except ImportError: 205d5a5a7bSMatthew Knepley sys.exit('''Could not locate BuildSystem in $PETSC_DIR/python. 215d5a5a7bSMatthew Knepley You can download this package using "bk clone bk://sidl.bkbits.net/BuildSystem $PETSC_DIR/python/BuildSystem"''') 22*2c4e8892SMatthew Knepley framework = config.framework.Framework(sys.argv[1:]+['-configModules=PETSc.Configure']+configure_options, loadArgDB = 0) 235d5a5a7bSMatthew Knepley framework.argDB['CPPFLAGS'] = '' 245d5a5a7bSMatthew Knepley framework.argDB['LIBS'] = '' 255d5a5a7bSMatthew Knepley framework.configure() 26358ebc22SMatthew Knepley framework.storeSubstitutions(framework.argDB) 275d5a5a7bSMatthew Knepley 285d5a5a7bSMatthew Knepleyif __name__ == '__main__': 295d5a5a7bSMatthew Knepley petsc_configure([]) 30