Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buildifier defects #449

Merged
merged 1 commit into from
Apr 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ filegroup(
"LICENSE",
"internal_deps.bzl",
"internal_setup.bzl",
"//python/pip_install:distribution",
"//python:distribution",
"//python/pip_install:distribution",
"//tools:distribution",
],
visibility = ["//distro:__pkg__"],
Expand Down
2 changes: 1 addition & 1 deletion docs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ bzl_library(
name = "bazel_repo_tools",
srcs = [
"@bazel_tools//tools:bzl_srcs",
]
],
)

bzl_library(
Expand Down
2 changes: 1 addition & 1 deletion examples/legacy_pip_import/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
)

load("@rules_python//python/legacy_pip_import:pip.bzl", "pip_import", "pip_repositories")
Expand Down
2 changes: 1 addition & 1 deletion examples/pip_install/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
)

load("@rules_python//python:pip.bzl", "pip_install")
Expand Down
2 changes: 1 addition & 1 deletion examples/pip_parse/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_python",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
sha256 = "778197e26c5fbeb07ac2a2c5ae405b30f6cb7ad1f5510ea6fdac03bded96cc6f",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.2.0/rules_python-0.2.0.tar.gz",
)

load("@rules_python//python:pip.bzl", "pip_parse")
Expand Down
13 changes: 8 additions & 5 deletions examples/wheel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ py_package(
py_package(
name = "example_pkg_with_data",
packages = ["examples.wheel"],
deps = [":main_with_gen_data"]
deps = [":main_with_gen_data"],
)

py_wheel(
Expand Down Expand Up @@ -99,7 +99,10 @@ py_wheel(
distribution = "example_customized",
entry_points = {
"console_scripts": ["another = foo.bar:baz"],
"group2": ["second = second.main:s", "first = first.main:f"]
"group2": [
"second = second.main:s",
"first = first.main:f",
],
},
homepage = "www.example.com",
license = "Apache 2.0",
Expand Down Expand Up @@ -158,8 +161,8 @@ py_wheel(
py_wheel(
name = "python_requires_in_a_package",
distribution = "example_python_requires_in_a_package",
python_tag = "py3",
python_requires = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
python_tag = "py3",
version = "0.0.1",
deps = [
":example_pkg",
Expand All @@ -172,8 +175,8 @@ py_wheel(
python_tag = "py3",
version = "0.0.1",
deps = [
":example_pkg_with_data"
]
":example_pkg_with_data",
],
)

py_wheel(
Expand Down
2 changes: 1 addition & 1 deletion experimental/python/wheel.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"""Obsolete. Use //python:packaging.bzl instead."""

# Load and re-export py_wheel and py_package for backwards compatibility.
load("//python:packaging.bzl", _py_wheel = "py_wheel", _py_package = "py_package")
load("//python:packaging.bzl", _py_package = "py_package", _py_wheel = "py_wheel")

py_wheel = _py_wheel
py_package = _py_package
2 changes: 1 addition & 1 deletion python/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ filegroup(
"defs.bzl",
"packaging.bzl",
"pip.bzl",
"whl.bzl",
"private/reexports.bzl",
"whl.bzl",
],
visibility = ["//:__pkg__"],
)
Expand Down
4 changes: 2 additions & 2 deletions python/legacy_pip_import/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def _pip_import_impl(repository_ctx):
]

# To see the output, pass: quiet=False
result = repository_ctx.execute(args, timeout=repository_ctx.attr.timeout)
result = repository_ctx.execute(args, timeout = repository_ctx.attr.timeout)

if result.return_code:
fail("pip_import failed: %s (%s)" % (result.stdout, result.stderr))
Expand All @@ -75,7 +75,7 @@ python_interpreter.
),
"timeout": attr.int(
default = 600,
doc = "Timeout (in seconds) for repository fetch."
doc = "Timeout (in seconds) for repository fetch.",
),
"_script": attr.label(
executable = True,
Expand Down
1 change: 1 addition & 0 deletions python/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def pip_install(requirements, name = "pip", **kwargs):
name: A unique name for the created external repository (default 'pip').
**kwargs: Keyword arguments passed directly to the `pip_repository` repository rule.
"""

# Just in case our dependencies weren't already fetched
pip_install_dependencies()

Expand Down
5 changes: 4 additions & 1 deletion python/pip_install/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ filegroup(
)

exports_files(
["pip_repository.bzl", "repositories.bzl"],
[
"pip_repository.bzl",
"repositories.bzl",
],
visibility = ["//docs:__pkg__"],
)
4 changes: 2 additions & 2 deletions python/pip_install/extract_wheels/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ load("//python/pip_install:repositories.bzl", "requirement")
py_library(
name = "lib",
srcs = [
"arguments.py",
"bazel.py",
"namespace_pkgs.py",
"purelib.py",
"requirements.py",
"wheel.py",
"arguments.py",
],
visibility = [
"//python/pip_install/extract_wheels:__subpackages__",
Expand Down Expand Up @@ -64,11 +64,11 @@ py_test(
srcs = [
"whl_filegroup_test.py",
],
data = ["//examples/wheel:minimal_with_py_package"],
tags = ["unit"],
deps = [
":lib",
],
data = ["//examples/wheel:minimal_with_py_package"]
)

py_test(
Expand Down
9 changes: 6 additions & 3 deletions python/pip_install/parse_requirements_to_bzl/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ py_binary(
py_library(
name = "lib",
srcs = ["__init__.py"],
deps = [requirement("pip")],
visibility = ["//python/pip_install/extract_wheels:__subpackages__"],
deps = [requirement("pip")],
)

py_test(
Expand All @@ -27,13 +27,16 @@ py_test(
tags = ["unit"],
deps = [
":lib",
"//python/pip_install/extract_wheels/lib"
"//python/pip_install/extract_wheels/lib",
],
)

filegroup(
name = "distribution",
srcs = glob(["*"], exclude = ["*_test.py"]) + [
srcs = glob(
["*"],
exclude = ["*_test.py"],
) + [
"//python/pip_install/parse_requirements_to_bzl/extract_single_wheel:distribution",
],
visibility = ["//python/pip_install:__subpackages__"],
Expand Down
2 changes: 1 addition & 1 deletion python/pip_install/pip_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ py_binary(

def _impl_whl_library(rctx):
# pointer to parent repo so these rules rerun if the definitions in requirements.bzl change.
_parent_repo_label = Label("@{parent}//:requirements.bzl".format(parent=rctx.attr.repo))
_parent_repo_label = Label("@{parent}//:requirements.bzl".format(parent = rctx.attr.repo))
pypath = _construct_pypath(rctx)
args = [
rctx.attr.python_interpreter,
Expand Down
2 changes: 1 addition & 1 deletion python/pip_install/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def requirement(pkg):
def pip_install_dependencies():
"""
Fetch dependencies these rules depend on. Workspaces that use the pip_install rule can call this.

(However we call it from pip_install, making it optional for users to do so.)
"""
for (name, url, sha256) in _RULE_DEPS:
Expand Down