Skip to content

Commit

Permalink
feat: keep main module in py_library (#1608)
Browse files Browse the repository at this point in the history
Unlike Go, the main module of Python can still be imported by other
modules. We should keep them in the `py_library` target to allow such
imports.
  • Loading branch information
linzhp committed Dec 14, 2023
1 parent 2b5447b commit e7d5c8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion gazelle/python/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ func (py *Python) GenerateRules(args language.GenerateArgs) language.GenerateRes
fqTarget.String(), actualPyBinaryKind, err)
continue
}
srcs.Remove(filename)
pyBinary := newTargetBuilder(pyBinaryKind, pyBinaryTargetName, pythonProjectRoot, args.Rel, pyFileNames).
addVisibility(visibility).
addSrc(filename).
Expand Down
2 changes: 2 additions & 0 deletions gazelle/python/testdata/binary_without_entrypoint/BUILD.out
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ py_library(
srcs = [
"__init__.py",
"collided_main.py",
"main.py",
"main2.py",
],
visibility = ["//:__subpackages__"],
)
Expand Down

0 comments on commit e7d5c8d

Please sign in to comment.