fix: only use ctx.attr.patches if patches param is not specified (#105)

The currently implementation differs from the docstring here and in upstream skylib:

This rule is intended to be used in the implementation function of
a repository rule. If the parameters "patches", "patch_tool",
"patch_args", "patch_cmds" and "patch_cmds_win" are not specified
then they are taken from "ctx.attr".
This commit is contained in:
Greg Magolan 2022-05-04 10:32:18 -07:00 committed by GitHub
parent 2b50f99ab3
commit 47114fd4f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -71,10 +71,10 @@ def patch(ctx, patches = None, patch_cmds = None, patch_cmds_win = None, patch_t
bash_exe = ctx.os.environ["BAZEL_SH"] if "BAZEL_SH" in ctx.os.environ else "bash"
powershell_exe = ctx.os.environ["BAZEL_POWERSHELL"] if "BAZEL_POWERSHELL" in ctx.os.environ else "powershell.exe"
if patches == None and hasattr(ctx.attr, "patches"):
patches = ctx.attr.patches
if patches == None:
patches = []
if hasattr(ctx.attr, "patches") and ctx.attr.patches:
patches += ctx.attr.patches
remote_patches = {}
remote_patch_strip = 0