• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 The Bazel Authors. All rights reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15load("//python:defs.bzl", "py_library")
16load("//python:packaging.bzl", "py_wheel")
17
18filegroup(
19    name = "distribution",
20    srcs = glob(["**"]),
21    visibility = ["//python:__pkg__"],
22)
23
24py_library(
25    name = "runfiles",
26    srcs = [
27        "__init__.py",
28        "runfiles.py",
29    ],
30    imports = [
31        # Add the repo root so `import python.runfiles.runfiles` works. This makes it agnostic
32        # to the --experimental_python_import_all_repositories setting.
33        "../..",
34    ],
35    visibility = ["//visibility:public"],
36)
37
38# This can be manually tested by running tests/runfiles/runfiles_wheel_integration_test.sh
39# We ought to have an automated integration test for it, too.
40# see https://github.com/bazelbuild/rules_python/issues/1002
41py_wheel(
42    name = "wheel",
43    # From https://pypi.org/classifiers/
44    classifiers = [
45        "Development Status :: 5 - Production/Stable",
46        "License :: OSI Approved :: Apache Software License",
47    ],
48    description_file = "README.rst",
49    dist_folder = "dist",
50    distribution = "bazel_runfiles",
51    homepage = "https://github.com/bazelbuild/rules_python",
52    strip_path_prefixes = ["python"],
53    twine = "@publish_deps_twine//:pkg",
54    # this can be replaced by building with --stamp --embed_label=1.2.3
55    version = "{BUILD_EMBED_LABEL}",
56    visibility = ["//visibility:public"],
57    deps = [":runfiles"],
58)
59