Skip to content

Commit da98fa5

Browse files
committed
Skip wheel patching with empty patches
Fixes #2263
1 parent 71417c5 commit da98fa5

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

python/private/pypi/patch_whl.bzl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ def patch_whl(rctx, *, python_interpreter, whl_path, patches, **kwargs):
6060
if not rctx.delete(whl_file_zip):
6161
fail("Failed to remove the symlink after extracting")
6262

63+
if not patches:
64+
fail("Trying to patch wheel without any patches")
65+
6366
for patch_file, patch_strip in patches.items():
6467
rctx.patch(patch_file, strip = patch_strip)
6568

python/private/pypi/whl_library.bzl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,16 @@ def _whl_library_impl(rctx):
266266
if whl_path.basename in patch_dst.whls:
267267
patches[patch_file] = patch_dst.patch_strip
268268

269-
whl_path = patch_whl(
270-
rctx,
271-
op = "whl_library.PatchWhl({}, {})".format(rctx.attr.name, rctx.attr.requirement),
272-
python_interpreter = python_interpreter,
273-
whl_path = whl_path,
274-
patches = patches,
275-
quiet = rctx.attr.quiet,
276-
timeout = rctx.attr.timeout,
277-
)
269+
if patches:
270+
whl_path = patch_whl(
271+
rctx,
272+
op = "whl_library.PatchWhl({}, {})".format(rctx.attr.name, rctx.attr.requirement),
273+
python_interpreter = python_interpreter,
274+
whl_path = whl_path,
275+
patches = patches,
276+
quiet = rctx.attr.quiet,
277+
timeout = rctx.attr.timeout,
278+
)
278279

279280
target_platforms = rctx.attr.experimental_target_platforms
280281
if target_platforms:

0 commit comments

Comments
 (0)