Skip to content

Commit 1d5d724

Browse files
author
Alex Eagle
committed
Fix buildifier warnings in rules_python_external
Just enough to get CI green for now Also ignore the merge commit in git blame and the subdirectory when expanding //... pattern
1 parent b381dcb commit 1d5d724

File tree

7 files changed

+30
-22
lines changed

7 files changed

+30
-22
lines changed

.bazelignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
experimental/rules_python_external
2+

.git-blame-ignore-revs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
aedcef6a8f039a06c87ea33cdb722779e3170ea3
2+
b381dcb8880358a6aa63b44560f43377f8bffaf3

experimental/rules_python_external/defs.bzl

+21-21
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
""
2+
13
load("//:repositories.bzl", "all_requirements")
24

35
DEFAULT_REPOSITORY_NAME = "pip"
@@ -48,9 +50,7 @@ def _pip_repository_impl(rctx):
4850
]
4951

5052
if rctx.attr.enable_implicit_namespace_pkgs:
51-
args += [
52-
"--enable_implicit_namespace_pkgs"
53-
]
53+
args.append("--enable_implicit_namespace_pkgs")
5454

5555
result = rctx.execute(
5656
args,
@@ -68,24 +68,6 @@ def _pip_repository_impl(rctx):
6868

6969
pip_repository = repository_rule(
7070
attrs = {
71-
"requirements": attr.label(allow_single_file = True, mandatory = True),
72-
"wheel_env": attr.string_dict(),
73-
"python_interpreter": attr.string(default = "python3"),
74-
"python_interpreter_target": attr.label(allow_single_file = True, doc = """
75-
If you are using a custom python interpreter built by another repository rule,
76-
use this attribute to specify its BUILD target. This allows pip_repository to invoke
77-
pip using the same interpreter as your toolchain. If set, takes precedence over
78-
python_interpreter.
79-
"""),
80-
# 600 is documented as default here: https://docs.bazel.build/versions/master/skylark/lib/repository_ctx.html#execute
81-
"timeout": attr.int(default = 600),
82-
"quiet": attr.bool(default = True),
83-
"extra_pip_args": attr.string_list(
84-
doc = "Extra arguments to pass on to pip. Must not contain spaces.",
85-
),
86-
"pip_data_exclude": attr.string_list(
87-
doc = "Additional data exclusion parameters to add to the pip packages BUILD file.",
88-
),
8971
"enable_implicit_namespace_pkgs": attr.bool(
9072
default = False,
9173
doc = """
@@ -96,6 +78,24 @@ and py_test targets must specify either `legacy_create_init=False` or the global
9678
This option is required to support some packages which cannot handle the conversion to pkg-util style.
9779
""",
9880
),
81+
"extra_pip_args": attr.string_list(
82+
doc = "Extra arguments to pass on to pip. Must not contain spaces.",
83+
),
84+
"pip_data_exclude": attr.string_list(
85+
doc = "Additional data exclusion parameters to add to the pip packages BUILD file.",
86+
),
87+
"python_interpreter": attr.string(default = "python3"),
88+
"python_interpreter_target": attr.label(allow_single_file = True, doc = """
89+
If you are using a custom python interpreter built by another repository rule,
90+
use this attribute to specify its BUILD target. This allows pip_repository to invoke
91+
pip using the same interpreter as your toolchain. If set, takes precedence over
92+
python_interpreter.
93+
"""),
94+
"quiet": attr.bool(default = True),
95+
"requirements": attr.label(allow_single_file = True, mandatory = True),
96+
# 600 is documented as default here: https://docs.bazel.build/versions/master/skylark/lib/repository_ctx.html#execute
97+
"timeout": attr.int(default = 600),
98+
"wheel_env": attr.string_dict(),
9999
},
100100
implementation = _pip_repository_impl,
101101
)

experimental/rules_python_external/example/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@pip//:requirements.bzl", "requirement")
2+
load("@rules_python//python:defs.bzl", "py_binary")
23

34
# Toolchain setup, this is optional.
45
# Demonstrate that we can use the same python interpreter for the toolchain and executing pip in pip install (see WORKSPACE).

experimental/rules_python_external/extract_wheels/BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("//:repositories.bzl", "all_requirements")
1+
load("@rules_python//python:defs.bzl", "py_binary")
22

33
py_binary(
44
name = "extract_wheels",

experimental/rules_python_external/extract_wheels/lib/BUILD

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
load("@rules_python//python:defs.bzl", "py_library", "py_test")
12
load("//:repositories.bzl", "requirement")
23

34
py_library(

experimental/rules_python_external/repositories.bzl

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
""
2+
13
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
24
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
35

0 commit comments

Comments
 (0)