def get_petsc_dir(): PETSC_DIR = os.environ.get('PETSC_DIR') if PETSC_DIR: return PETSC_DIR try: import petsc PETSC_DIR = petsc.get_petsc_dir() except ImportError: log.warn("PETSC_DIR not specified") PETSC_DIR = os.path.join(os.path.sep, 'usr', 'local', 'petsc') return PETSC_DIR
def get_petsc_dir(): try: return os.environ['PETSC_DIR'] except KeyError: try: import petsc return petsc.get_petsc_dir() except ImportError: sys.exit("""Error: Could not find PETSc library. Set the environment variable PETSC_DIR to your local PETSc base directory or install PETSc from PyPI: pip install petsc""")
def get_petsc_dir(petsc_dir): if not petsc_dir: return None petsc_dir = os.path.expandvars(petsc_dir) if not petsc_dir or '$PETSC_DIR' in petsc_dir: try: import petsc petsc_dir = petsc.get_petsc_dir() except ImportError: log.warn("PETSC_DIR not specified") return None petsc_dir = os.path.expanduser(petsc_dir) petsc_dir = os.path.abspath(petsc_dir) return config.chk_petsc_dir(petsc_dir)
def get_petsc_dir(): try: arch = '/' + env.get('PETSC_ARCH', '') dir = env['PETSC_DIR'] return (dir, dir + arch) except KeyError: try: import petsc return (petsc.get_petsc_dir(), ) except ImportError: sys.exit("""Error: Could not find PETSc library. Set the environment variable PETSC_DIR to your local PETSc base directory or install PETSc from PyPI: pip install petsc""")
def get_petsc_dir(): try: petsc_arch = env.get('PETSC_ARCH', '') petsc_dir = env['PETSC_DIR'] if petsc_arch: return (petsc_dir, path.join(petsc_dir, petsc_arch)) return (petsc_dir,) except KeyError: try: import petsc return (petsc.get_petsc_dir(), ) except ImportError: sys.exit("""Error: Could not find PETSc library. Set the environment variable PETSC_DIR / PETSC_ARCH to your local PETSc base directory or install PETSc via pip.""")
def get_petsc_dir(): try: petsc_arch = env.get('PETSC_ARCH', '') petsc_dir = env['PETSC_DIR'] if petsc_arch: return (petsc_dir, path.join(petsc_dir, petsc_arch)) return (petsc_dir, ) except KeyError: try: import petsc return (petsc.get_petsc_dir(), ) except ImportError: sys.exit("""Error: Could not find PETSc library. Set the environment variable PETSC_DIR to your local PETSc base directory or install PETSc from PyPI as described in the manual: http://firedrakeproject.org/obtaining_pyop2.html#petsc """)
def get_petsc_dir(): try: petsc_arch = env.get('PETSC_ARCH', '') petsc_dir = env['PETSC_DIR'] if petsc_arch: return (petsc_dir, path.join(petsc_dir, petsc_arch)) return (petsc_dir,) except KeyError: try: import petsc return (petsc.get_petsc_dir(), ) except ImportError: sys.exit("""Error: Could not find PETSc library. Set the environment variable PETSC_DIR to your local PETSc base directory or install PETSc from PyPI as described in the manual: http://firedrakeproject.org/obtaining_pyop2.html#petsc """)