Skip to content

Commit f6d56c9

Browse files
committed
Run through pyformat to reduce whitespace diff
When using an external editor (or clang-format --style=Google for that matter), we get a bunch of noisy whitespace diffs. pyformat is the way.
1 parent 2f205a4 commit f6d56c9

File tree

1 file changed

+38
-36
lines changed

1 file changed

+38
-36
lines changed

protobuf_javascript_release.bzl

+38-36
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
1-
"""
2-
Generates package naming variables for use with rules_pkg.
3-
"""
1+
"""Generates package naming variables for use with rules_pkg."""
42

53
load("@rules_pkg//:providers.bzl", "PackageVariablesInfo")
64
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
75

86
_PROTOBUF_JAVASCRIPT_VERSION = "3.21.1"
97

8+
109
def _package_naming_impl(ctx):
11-
values = {}
12-
values["version"] = _PROTOBUF_JAVASCRIPT_VERSION
13-
14-
# infer from the current cpp toolchain.
15-
toolchain = find_cpp_toolchain(ctx)
16-
cpu = toolchain.cpu
17-
system_name = toolchain.target_gnu_system_name
18-
19-
# rename cpus to match what we want artifacts to be
20-
if cpu == "systemz":
21-
cpu = "s390_64"
22-
elif cpu == "aarch64":
23-
cpu = "aarch_64"
24-
elif cpu == "ppc64":
25-
cpu = "ppcle_64"
26-
27-
# use the system name to determine the os and then create platform names
28-
if "apple" in system_name:
29-
values["platform"] = "osx-" + cpu
30-
elif "linux" in system_name:
31-
values["platform"] = "linux-" + cpu
32-
elif "mingw" in system_name:
33-
if cpu == "x86_64":
34-
values["platform"] = "win64"
35-
else:
36-
values["platform"] = "win32"
10+
values = {}
11+
values["version"] = _PROTOBUF_JAVASCRIPT_VERSION
12+
13+
# infer from the current cpp toolchain.
14+
toolchain = find_cpp_toolchain(ctx)
15+
cpu = toolchain.cpu
16+
system_name = toolchain.target_gnu_system_name
17+
18+
# rename cpus to match what we want artifacts to be
19+
if cpu == "systemz":
20+
cpu = "s390_64"
21+
elif cpu == "aarch64":
22+
cpu = "aarch_64"
23+
elif cpu == "ppc64":
24+
cpu = "ppcle_64"
25+
26+
# use the system name to determine the os and then create platform names
27+
if "apple" in system_name:
28+
values["platform"] = "osx-" + cpu
29+
elif "linux" in system_name:
30+
values["platform"] = "linux-" + cpu
31+
elif "mingw" in system_name:
32+
if cpu == "x86_64":
33+
values["platform"] = "win64"
3734
else:
38-
values["platform"] = "unknown"
35+
values["platform"] = "win32"
36+
else:
37+
values["platform"] = "unknown"
38+
39+
return PackageVariablesInfo(values=values)
3940

40-
return PackageVariablesInfo(values = values)
4141

4242
package_naming = rule(
43-
implementation = _package_naming_impl,
44-
attrs = {
43+
implementation=_package_naming_impl,
44+
attrs={
4545
# Necessary data dependency for find_cpp_toolchain.
46-
"_cc_toolchain": attr.label(default = Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
46+
"_cc_toolchain":
47+
attr.label(
48+
default=Label("@bazel_tools//tools/cpp:current_cc_toolchain")),
4749
},
48-
toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
49-
incompatible_use_toolchain_transition = True,
50+
toolchains=["@bazel_tools//tools/cpp:toolchain_type"],
51+
incompatible_use_toolchain_transition=True,
5052
)

0 commit comments

Comments
 (0)