1#!/bin/sh 2 3"true" '''\' 4for pyimpl in python3 python python2; do 5 which $pyimpl > /dev/null 2>&1 6 if [ $? -eq 0 ]; then 7 exec $pyimpl "$0" "$@" 8 fi 9done 10echo "Error! Could not locate Python! Please install and have python3, python, or python2 in PATH." 11echo "Or use: /path/to/valid/python configure $@" 12exit 127 13''' 14 15import sys, os 16 17banner_length = 93 18banner_sep = '*' 19banner_line = banner_sep*banner_length 20 21if sys.version_info < (3,0): 22 print(banner_line) 23 print(banner_sep+'python2 support in configure is deprecated'.center(banner_length-2)+banner_sep) 24 print(banner_sep+'PETSc version 3.18+ will require at least python3.4'.center(banner_length-2)+banner_sep) 25 print(banner_line) 26 27if sys.version_info < (2,7) or ((3,0) <= sys.version_info < (3,4)): 28 print(banner_line) 29 print(banner_sep+'Python version 2.7 or 3.4+ is required to run ./configure'.center(banner_length-2)+banner_sep) 30 print(banner_sep+'Try: "python3 ./configure" or "python2.7 ./configure"'.center(banner_length-2)+banner_sep) 31 print(banner_line) 32 sys.exit(4) 33 34sys.path.insert(0, os.path.abspath('config')) 35import configure 36configure.petsc_configure([]) 37