From f2dc241ce12f19dd4ca4a6833b374b9d169159e2 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 3 Oct 2024 18:32:48 +0100 Subject: [PATCH] Tweak comments --- python/ruff/__main__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python/ruff/__main__.py b/python/ruff/__main__.py index 47c60499db6611..36efd99d7fef54 100644 --- a/python/ruff/__main__.py +++ b/python/ruff/__main__.py @@ -33,12 +33,13 @@ def find_ruff_bin() -> str: if os.path.isfile(target_path): return target_path - # Might be a pip build environment + # Search for pip-specific build environments. + # + # See: https://github.com/pypa/pip/blob/102d8187a1f5a4cd5de7a549fd8a9af34e89a54f/src/pip/_internal/build_env.py#L87 paths = os.environ.get("PATH", "").split(os.pathsep) if len(paths) >= 2: - # https://github.com/pypa/pip/blob/main/src/pip/_internal/build_env.py#L87 first, second = os.path.split(paths[0]), os.path.split(paths[1]) - # we need an overlay and normal folder within pip-build-env-{random} folders + # Search for both an `overlay` and `normal` folder within a `pip-build-env-{random}` folder. if ( len(first) >= 3 and len(second) >= 3 @@ -47,7 +48,8 @@ def find_ruff_bin() -> str: and second[-3].startswith("pip-build-env-") and second[-2] == "normal" ): - candidate = os.path.join(first, ruff_exe) # the overlay contains ruff + # The overlay must contain the ruff binary. + candidate = os.path.join(first, ruff_exe) if os.path.isfile(candidate): return candidate