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 __HOLE__:
            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""")
dataset/ETHPy150Open OP2/PyOP2/setup.py/get_petsc_dir