8000 Fix errors with incompatible_disallow_empty_glob (#315) · rahulmutt/rules_python@cd55272 · GitHub
[go: up one dir, main page]

Skip to content

Commit cd55272

Browse files
Fix errors with incompatible_disallow_empty_glob (bazel-contrib#315)
Allow py_library sources to be empty. If --incompatible_disallow_empty_glob is set then generated py_library targets will fail if there are no .py files. Examples are pymssql==2.1.4 and cx-Oracle==7.2.3. Set `allow_empty = True` for glob(). Bazel issue for incompatible_disallow_empty_glob: bazelbuild/bazel#8195 Co-authored-by: Andy Scott <andyscott@users.noreply.github.com>
1 parent cfcc675 commit cd55272

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packaging/whl.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,13 @@ def _parse_metadata(self, content):
133133
help='The set of extras for which to generate library targets.')
134134

135135
def main():
136+
" 8000 ""
137+
Generate a BUILD file for an unzipped Wheel
138+
139+
We allow for empty Python sources as for Wheels containing only compiled C code
140+
there may be no Python sources whatsoever (e.g. packages written in Cython: like `pymssql`).
141+
"""
142+
136143
args = parser.parse_args()
137144
whl = Wheel(args.whl)
138145

@@ -148,7 +155,7 @@ def main():
148155
149156
py_library(
150157
name = "pkg",
151-
srcs = glob(["**/*.py"]),
158+
srcs = glob(["**/*.py"], allow_empty = True),
152159
data = glob(["**/*"], exclude=["**/*.py", "**/* *", "BUILD", "WORKSPACE"]),
153160
# This makes this directory a top-level in the python import
154161
# search path for anything that depends on this.

0 commit comments

Comments
 (0)
0