MCPcopy Create free account
hub / github.com/astral-sh/ruff / get_executable_path

Function get_executable_path

python/ruff-ecosystem/ruff_ecosystem/cli.py:184–199  ·  view source on GitHub ↗
(name: str)

Source from the content-addressed store, hash-verified

182
183
184def get_executable_path(name: str) -> Path | None:
185 # Add suffix for Windows executables
186 name += ".exe" if sys.platform == "win32" and not name.endswith(".exe") else ""
187
188 path = os.path.join(sysconfig.get_path("scripts"), name)
189
190 # The executable in the current interpreter's scripts directory.
191 if os.path.exists(path):
192 return Path(path)
193
194 # The executable in the global environment.
195 environment_path = shutil.which(name)
196 if environment_path:
197 return Path(environment_path)
198
199 return None

Callers 1

entrypointFunction · 0.85

Calls 4

PathClass · 0.85
joinMethod · 0.45
existsMethod · 0.45
whichMethod · 0.45

Tested by

no test coverage detected