rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

Gazelle incorrectly ignores files called `setup.py`.

Open dougthor42 opened this issue 1 year ago • 5 comments

🐞 bug report

Affected Rule

  • gazelle

Is this a regression?

No, seems like it's been present from the begining (a5a7ffbf4 / #514).

Description

Gazelle incorrectly ignores files called setup.py.

I believe this was added because the root setup.py is something that doesn't need a bazel target (I'm not actually sure if that's true...) or maybe it's because the root setup.py is annoying to run Gazelle on.

Anyway, the problem is that any file called setup.py will also be ignored.

I'm fine with the root setup.py being ignored, though I reserve the right to change my mind in the future :laughing:

This is the issue: https://github.com/bazelbuild/rules_python/blob/fa13b0138924245c55f79922509e4688f252ff71/gazelle/pythonconfig/pythonconfig.go#L128-L130

We can very easily update the test case to account for this.

🔬 Minimal Reproduction

Dir structure:

.
|-- src/
|   +-- setup.py
|
+-- MODULE.bazel

Expected result:

A //src/setup target is made in src/BUILD.bazel.

Actual result

A //src/setup target is not made in src/BUILD.bazel.

🔥 Exception or Error

N/A

🌍 Your Environment

Operating System:

gLinux

Output of bazel version:

7.2.0

Rules_python version:

0.31.0

Anything else relevant?

dougthor42 avatar Aug 05 '24 22:08 dougthor42