Skip to content

Commit

Permalink
Replace struct.to_json() with json.encode(struct)
Browse files Browse the repository at this point in the history
The legacy, implicit struct methods are decommissioned in Bazel
v8.0 and onwards. See:
bazelbuild/bazel#19465 .
  • Loading branch information
plobsing committed Jan 6, 2025
1 parent aab8bae commit 75e1801
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/pip_install/pip_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ def _parse_optional_attrs(rctx, args):
if extra_args:
args += [
"--extra_pip_args",
struct(args = extra_args).to_json(),
json.encode(struct(args = extra_args)),
]

if rctx.attr.pip_data_exclude:
args += [
"--pip_data_exclude",
struct(exclude = rctx.attr.pip_data_exclude).to_json(),
json.encode(struct(exclude = rctx.attr.pip_data_exclude)),
]

if rctx.attr.enable_implicit_namespace_pkgs:
Expand Down Expand Up @@ -93,7 +93,7 @@ def _pip_repository_impl(rctx):
if rctx.attr.pip_platform_definitions:
args.extend([
"--pip_platform_definitions",
struct(args = {str(k): v for k, v in rctx.attr.pip_platform_definitions.items()}).to_json(),
json.encode(struct(args = {str(k): v for k, v in rctx.attr.pip_platform_definitions.items()})),
])
else:
args = [
Expand Down Expand Up @@ -316,4 +316,4 @@ platform_alias = repository_rule(
implementation = _impl_platform_alias,
doc = """
An internal rule used to create an alias for a pip package for the appropriate platform."""
)
)

0 comments on commit 75e1801

Please sign in to comment.