Skip to content

Commit

Permalink
Tweak comments
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Oct 3, 2024
1 parent 3d86535 commit 5476fde
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/ruff/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ 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. (The final segment
# of the path is the `bin` directory.)
if (
len(first) >= 3
and len(second) >= 3
Expand All @@ -47,7 +49,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

Expand Down

0 comments on commit 5476fde

Please sign in to comment.