diff options
author | Zhongpeng Lin <zplin@uber.com> | 2023-12-13 16:24:52 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 00:24:52 +0000 |
commit | e7d5c8db6dccbea2c1a8ee731f9a472edee680cf (patch) | |
tree | ca5712e341470e6b01101dfe330d0c12f5bf9a74 | |
parent | 2b5447bca3b85141aedc7676f83a19ea2f030739 (diff) | |
download | bazelbuild-rules_python-e7d5c8db6dccbea2c1a8ee731f9a472edee680cf.tar.gz |
feat: keep main module in py_library (#1608)
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.
-rw-r--r-- | gazelle/python/generate.go | 1 | ||||
-rw-r--r-- | gazelle/python/testdata/binary_without_entrypoint/BUILD.out | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/gazelle/python/generate.go b/gazelle/python/generate.go index f812f17..8d147d9 100644 --- a/gazelle/python/generate.go +++ b/gazelle/python/generate.go @@ -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). diff --git a/gazelle/python/testdata/binary_without_entrypoint/BUILD.out b/gazelle/python/testdata/binary_without_entrypoint/BUILD.out index c88f2ff..9dae147 100644 --- a/gazelle/python/testdata/binary_without_entrypoint/BUILD.out +++ b/gazelle/python/testdata/binary_without_entrypoint/BUILD.out @@ -24,6 +24,8 @@ py_library( srcs = [ "__init__.py", "collided_main.py", + "main.py", + "main2.py", ], visibility = ["//:__subpackages__"], ) |