Remove forgotten fragments of `pip_import` rule. (#588)
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index cf6c962..acdfc49 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS
@@ -7,7 +7,6 @@ /python/ @brandjon @lberki # But not everything under python/ is the core Python rules. /python/pip.bzl @thundergolfer @andyscott -/python/whl.bzl @thundergolfer @andyscott /python/requirements.txt @thundergolfer @andyscott # Directory containing the Gazelle extension and Go code.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index da4b625..41dbd96 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md
@@ -62,7 +62,7 @@ Practically, this means that a Bazel team member should approve any PR concerning the core Python logic. This includes everything under the `python/` -directory except for `pip.bzl`, `whl.bzl`, and `requirements.txt`. +directory except for `pip.bzl` and `requirements.txt`. Issues should be triaged as follows:
diff --git a/docs/BUILD b/docs/BUILD index 4264bd3..fe883d1 100644 --- a/docs/BUILD +++ b/docs/BUILD
@@ -25,7 +25,6 @@ "packaging": "//docs:packaging-docs", "pip": "//docs:pip-docs", "python": "//docs:core-docs", - "whl": "//docs:whl-docs", } # We define these bzl_library targets here rather than in the //python package @@ -86,10 +85,6 @@ deps = [":defs"], ) -# TODO: Consider merging documentation pages for whl and pip. This would -# require re-exporting their symbols from a common .bzl; see -# https://github.com/bazelbuild/skydoc/issues/208. - stardoc( name = "pip-docs", out = "pip.md_", @@ -102,12 +97,6 @@ ) stardoc( - name = "whl-docs", - out = "whl.md_", - input = "//python:whl.bzl", -) - -stardoc( name = "packaging-docs", out = "packaging.md_", input = "//python:packaging.bzl",
diff --git a/docs/whl.md b/docs/whl.md deleted file mode 100755 index bf8c73f..0000000 --- a/docs/whl.md +++ /dev/null
@@ -1,40 +0,0 @@ -<!-- Generated with Stardoc: http://skydoc.bazel.build --> - -<a name="#whl_library"></a> - -## whl_library - -<pre> -whl_library(<a href="#whl_library-name">name</a>, <a href="#whl_library-extras">extras</a>, <a href="#whl_library-python_interpreter">python_interpreter</a>, <a href="#whl_library-requirements">requirements</a>, <a href="#whl_library-whl">whl</a>) -</pre> - -A rule for importing `.whl` dependencies into Bazel. - -<b>This rule is currently used to implement `pip_import`. It is not intended to -work standalone, and the interface may change.</b> See `pip_import` for proper -usage. - -This rule imports a `.whl` file as a `py_library`: -```python -whl_library( - name = "foo", - whl = ":my-whl-file", - requirements = "name of pip_import rule", -) -``` - -This rule defines `@foo//:pkg` as a `py_library` target. - - -**ATTRIBUTES** - - -| Name | Description | Type | Mandatory | Default | -| :-------------: | :-------------: | :-------------: | :-------------: | :-------------: | -| name | A unique name for this repository. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | | -| extras | A subset of the "extras" available from this <code>.whl</code> for which <code>requirements</code> has the dependencies. | List of strings | optional | [] | -| python_interpreter | The command to run the Python interpreter used when unpacking the wheel. | String | optional | "python" | -| requirements | The name of the <code>pip_import</code> repository rule from which to load this <code>.whl</code>'s dependencies. | String | optional | "" | -| whl | The path to the <code>.whl</code> file. The name is expected to follow [this convention](https://www.python.org/dev/peps/pep-0427/#file-name-convention)). | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | | - -
diff --git a/python/BUILD b/python/BUILD index 9470ad6..96df383 100644 --- a/python/BUILD +++ b/python/BUILD
@@ -46,7 +46,6 @@ "defs.bzl", "packaging.bzl", "pip.bzl", - "whl.bzl", "//python/private:bzl", ], visibility = ["//:__pkg__"], @@ -135,5 +134,4 @@ exports_files([ "packaging.bzl", "pip.bzl", - "whl.bzl", ])
diff --git a/python/whl.bzl b/python/whl.bzl deleted file mode 100644 index 336a782..0000000 --- a/python/whl.bzl +++ /dev/null
@@ -1,83 +0,0 @@ -# Copyright 2017 Google Inc. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -"""Import .whl files into Bazel.""" - -def _whl_impl(repository_ctx): - """Core implementation of whl_library.""" - - args = [ - repository_ctx.attr.python_interpreter, - repository_ctx.path(repository_ctx.attr._script), - "--whl", - repository_ctx.path(repository_ctx.attr.whl), - "--requirements", - repository_ctx.attr.requirements, - ] - - if repository_ctx.attr.extras: - args += [ - "--extras=%s" % extra - for extra in repository_ctx.attr.extras - ] - - result = repository_ctx.execute(args) - if result.return_code: - fail("whl_library failed: %s (%s)" % (result.stdout, result.stderr)) - -whl_library = repository_rule( - attrs = { - "extras": attr.string_list(doc = """ -A subset of the "extras" available from this `.whl` for which -`requirements` has the dependencies. -"""), - "python_interpreter": attr.string(default = "python", doc = """ -The command to run the Python interpreter used when unpacking the wheel. -"""), - "requirements": attr.string(doc = """ -The name of the `pip_import` repository rule from which to load this -`.whl`'s dependencies. -"""), - "whl": attr.label( - mandatory = True, - allow_single_file = True, - doc = """ -The path to the `.whl` file. The name is expected to follow [this -convention](https://www.python.org/dev/peps/pep-0427/#file-name-convention)). -""", - ), - "_script": attr.label( - executable = True, - default = Label("//tools:whltool.par"), - cfg = "host", - ), - }, - implementation = _whl_impl, - doc = """A rule for importing `.whl` dependencies into Bazel. - -<b>This rule is currently used to implement `pip_import`. It is not intended to -work standalone, and the interface may change.</b> See `pip_import` for proper -usage. - -This rule imports a `.whl` file as a `py_library`: -```python -whl_library( - name = "foo", - whl = ":my-whl-file", - requirements = "name of pip_import rule", -) -``` - -This rule defines `@foo//:pkg` as a `py_library` target. -""", -)