Skip to content

Commit

Permalink
chore: fix e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeagle committed Mar 19, 2024
1 parent 4d62f0b commit d70ffa3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 5 additions & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ register_toolchains(
)

# Shows how a typical Python user fetches all the dependencies of their app, including the protobuf runtime
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip = use_extension(
"@rules_python//python/extensions:pip.bzl",
"pip",
dev_dependency = True,
)
pip.parse(
hub_name = "pypi",
python_version = "3.11",
Expand Down
9 changes: 5 additions & 4 deletions protoc/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def _google_protobuf_alias_repo_impl(rctx):
alias(name = "any_proto", actual = "@{0}//:any_proto")
""".format(rctx.attr.alias_to))

_google_protobuf_alias_repo = repository_rule(_google_protobuf_alias_repo_impl, attrs={"alias_to": attr.string()})
_google_protobuf_alias_repo = repository_rule(_google_protobuf_alias_repo_impl, attrs = {"alias_to": attr.string()})

def protoc_toolchains(name, version, google_protobuf = None, alias_to = "osx-aarch_64", register = True):
"""A utility method to load all Protobuf toolchains.
Expand All @@ -42,13 +42,14 @@ def protoc_toolchains(name, version, google_protobuf = None, alias_to = "osx-aar

for platform in PROTOC_PLATFORMS.keys():
prebuilt_protoc_repo(
# We must replace hyphen with underscore to workaround rules_python
# We must replace hyphen with underscore to workaround rules_python
# File "/output-base/external/rules_python~override/python/private/proto/py_proto_library.bzl", line 62, column 17, in _py_proto_aspect_impl
# Error in fail: Cannot generate Python code for a .proto whose path contains '-'
# Error in fail: Cannot generate Python code for a .proto whose path contains '-'
# (external/_main~protoc~toolchains_protoc_hub.osx-aarch_64/include/google/protobuf/any.proto).
name = ".".join([name, platform.replace("-", "_")]),
platform = platform,
version = version)
version = version,
)
protoc_toolchains_repo(name = name, user_repository_name = name)
if register:
native.register_toolchains("@{}//:all".format(name))
Expand Down

0 comments on commit d70ffa3

Please sign in to comment.