MCPcopy Create free account
hub / github.com/BasisResearch/lean.py / find_lean_dynlib

Function find_lean_dynlib

lean_py/utils.py:66–87  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

64
65
66def lean_include_dir() -> Path:
67 """Directory containing `lean/lean.h`."""
68 return lean_prefix() / "include"
69
70
71@lru_cache(maxsize=1)
72def 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
80def find_lean_dynlib() -> Path:
81 """Locate `libleanshared.<ext>` in the active toolchain&#x27;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():

Callers 1

__init__Function · 0.90

Calls 4

shared_lib_extensionFunction · 0.85
lean_lib_dirFunction · 0.85
run_commandFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected