Locate `libleanshared. ` in the active toolchain's `lib/lean`. Set ``LEANPY_LIBLEAN`` to override — useful for pointing at an ASAN-instrumented ``libleanshared.so`` on a debug box.
()
| 64 | |
| 65 | |
| 66 | def lean_include_dir() -> Path: |
| 67 | """Directory containing `lean/lean.h`.""" |
| 68 | return lean_prefix() / "include" |
| 69 | |
| 70 | |
| 71 | @lru_cache(maxsize=1) |
| 72 | def shared_lib_extension() -> str: |
| 73 | if sys.platform == "darwin": |
| 74 | return ".dylib" |
| 75 | if sys.platform == "win32": |
| 76 | return ".dll" |
| 77 | return ".so" |
| 78 | |
| 79 | |
| 80 | def find_lean_dynlib() -> Path: |
| 81 | """Locate `libleanshared.<ext>` in the active toolchain's `lib/lean`. |
| 82 | |
| 83 | Set ``LEANPY_LIBLEAN`` to override — useful for pointing at an |
| 84 | ASAN-instrumented ``libleanshared.so`` on a debug box. |
| 85 | """ |
| 86 | if env := os.environ.get("LEANPY_LIBLEAN"): |
| 87 | return Path(env) |
| 88 | ext = shared_lib_extension() |
| 89 | lib = lean_lib_dir() / f"libleanshared{ext}" |
| 90 | if lib.exists(): |
no test coverage detected