uranusjr commented on code in PR #62277:
URL: https://github.com/apache/airflow/pull/62277#discussion_r2867057654
##########
dev/breeze/src/airflow_breeze/utils/run_utils.py:
##########
@@ -212,6 +212,16 @@ def get_environments_to_print(env: Mapping[str, str] |
None):
return env_to_print
+def get_prek_executable() -> str:
+ """Return path to prek executable in same env as breeze (bin/prek)."""
+ prek_bin = shutil.which("prek", path=str(Path(sys.executable).parent))
+ if prek_bin is not None:
+ return prek_bin
+ # Fallback when prek is not found via which (e.g. Windows .exe resolution)
+ prek_in_bin = Path(sys.executable).parent / ("prek.exe" if sys.platform ==
"win32" else "prek")
Review Comment:
When is this ever useful? The logic is basically the same as `shutil.which`
(which works on Windows, the suffix is searched) and you’re just returning a
path guarenteed to not work. Why not just raise and exception?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]