xref: /aosp_15_r20/external/bazelbuild-rules_python/python/private/py_repositories.bzl (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1# Copyright 2024 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
15"""This file contains macros to be called during WORKSPACE evaluation."""
16
17load("@bazel_tools//tools/build_defs/repo:http.bzl", _http_archive = "http_archive")
18load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
19load("//python/private/pypi:deps.bzl", "pypi_deps")
20load(":internal_config_repo.bzl", "internal_config_repo")
21
22def http_archive(**kwargs):
23    maybe(_http_archive, **kwargs)
24
25def py_repositories():
26    """Runtime dependencies that users must install.
27
28    This function should be loaded and called in the user's `WORKSPACE`.
29    With `bzlmod` enabled, this function is not needed since `MODULE.bazel` handles transitive deps.
30    """
31    maybe(
32        internal_config_repo,
33        name = "rules_python_internal",
34    )
35    http_archive(
36        name = "bazel_skylib",
37        sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
38        urls = [
39            "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
40            "https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
41        ],
42    )
43    http_archive(
44        name = "rules_cc",
45        urls = ["https://github.com/bazelbuild/rules_cc/releases/download/0.0.9/rules_cc-0.0.9.tar.gz"],
46        sha256 = "2037875b9a4456dce4a79d112a8ae885bbc4aad968e6587dca6e64f3a0900cdf",
47        strip_prefix = "rules_cc-0.0.9",
48    )
49    pypi_deps()
50