xref: /aosp_15_r20/external/bazelbuild-rules_python/python/private/pypi/BUILD.bazel (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
15load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
16load("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED")
17
18package(default_visibility = ["//:__subpackages__"])
19
20licenses(["notice"])
21
22filegroup(
23    name = "distribution",
24    srcs = glob(
25        ["**"],
26        exclude = ["requirements.txt"],
27    ) + [
28        "//python/private/pypi/dependency_resolver:distribution",
29        "//python/private/pypi/whl_installer:distribution",
30    ],
31    visibility = ["//python/private:__pkg__"],
32)
33
34# Filegroup of bzl files that can be used by downstream rules for documentation generation
35filegroup(
36    name = "bzl",
37    srcs = glob(["**/*.bzl"]),
38    visibility = [
39        "//python/private:__pkg__",
40        "//tools/private:__pkg__",
41    ],
42)
43
44filegroup(
45    name = "requirements_txt",
46    srcs = ["requirements.txt"],
47    visibility = ["//tools/private/update_deps:__pkg__"],
48)
49
50# Keep sorted by library name and keep the files named by the main symbol they export
51
52bzl_library(
53    name = "attrs_bzl",
54    srcs = ["attrs.bzl"],
55)
56
57bzl_library(
58    name = "extension_bzl",
59    srcs = ["extension.bzl"],
60    deps = [
61        ":attrs_bzl",
62        ":hub_repository_bzl",
63        ":parse_requirements_bzl",
64        ":evaluate_markers_bzl",
65        ":parse_whl_name_bzl",
66        ":pip_repository_attrs_bzl",
67        ":simpleapi_download_bzl",
68        ":whl_library_bzl",
69        ":whl_repo_name_bzl",
70        "//python/private:full_version_bzl",
71        "//python/private:normalize_name_bzl",
72        "//python/private:version_label_bzl",
73        "//python/private:semver_bzl",
74        "@bazel_features//:features",
75    ] + [
76        "@pythons_hub//:interpreters_bzl",
77    ] if BZLMOD_ENABLED else [],
78)
79
80bzl_library(
81    name = "config_settings_bzl",
82    srcs = ["config_settings.bzl"],
83    deps = ["flags_bzl"],
84)
85
86bzl_library(
87    name = "deps_bzl",
88    srcs = ["deps.bzl"],
89    deps = [
90        "//python/private:bazel_tools_bzl",
91    ],
92)
93
94bzl_library(
95    name = "evaluate_markers_bzl",
96    srcs = ["evaluate_markers.bzl"],
97    deps = [
98        ":pypi_repo_utils_bzl",
99    ],
100)
101
102bzl_library(
103    name = "flags_bzl",
104    srcs = ["flags.bzl"],
105    deps = [
106        "//python/private:enum_bzl",
107        "@bazel_skylib//rules:common_settings",
108    ],
109)
110
111bzl_library(
112    name = "generate_whl_library_build_bazel_bzl",
113    srcs = ["generate_whl_library_build_bazel.bzl"],
114    deps = [
115        ":labels_bzl",
116        "//python/private:normalize_name_bzl",
117    ],
118)
119
120bzl_library(
121    name = "generate_group_library_build_bazel_bzl",
122    srcs = ["generate_group_library_build_bazel.bzl"],
123    deps = [
124        ":labels_bzl",
125        "//python/private:normalize_name_bzl",
126    ],
127)
128
129bzl_library(
130    name = "group_library_bzl",
131    srcs = ["group_library.bzl"],
132    deps = [
133        ":generate_group_library_build_bazel_bzl",
134    ],
135)
136
137bzl_library(
138    name = "hub_repository_bzl",
139    srcs = ["hub_repository.bzl"],
140    visibility = ["//:__subpackages__"],
141    deps = [
142        ":render_pkg_aliases_bzl",
143        "//python/private:text_util_bzl",
144    ],
145)
146
147bzl_library(
148    name = "index_sources_bzl",
149    srcs = ["index_sources.bzl"],
150)
151
152bzl_library(
153    name = "labels_bzl",
154    srcs = ["labels.bzl"],
155)
156
157bzl_library(
158    name = "multi_pip_parse_bzl",
159    srcs = ["multi_pip_parse.bzl"],
160    deps = [
161        "pip_repository_bzl",
162        "//python/private:text_util_bzl",
163    ],
164)
165
166bzl_library(
167    name = "package_annotation_bzl",
168    srcs = ["package_annotation.bzl"],
169)
170
171bzl_library(
172    name = "parse_requirements_bzl",
173    srcs = ["parse_requirements.bzl"],
174    deps = [
175        ":index_sources_bzl",
176        ":parse_requirements_txt_bzl",
177        ":pypi_repo_utils_bzl",
178        ":requirements_files_by_platform_bzl",
179        ":whl_target_platforms_bzl",
180        "//python/private:normalize_name_bzl",
181        "//python/private:repo_utils_bzl",
182    ],
183)
184
185bzl_library(
186    name = "parse_requirements_txt_bzl",
187    srcs = ["parse_requirements_txt.bzl"],
188)
189
190bzl_library(
191    name = "parse_simpleapi_html_bzl",
192    srcs = ["parse_simpleapi_html.bzl"],
193)
194
195bzl_library(
196    name = "parse_whl_name_bzl",
197    srcs = ["parse_whl_name.bzl"],
198)
199
200bzl_library(
201    name = "patch_whl_bzl",
202    srcs = ["patch_whl.bzl"],
203    deps = [
204        ":parse_whl_name_bzl",
205        "//python/private:repo_utils_bzl",
206    ],
207)
208
209bzl_library(
210    name = "pip_bzl",
211    srcs = ["pip.bzl"],
212    deps = [
213        ":extension_bzl",
214    ],
215)
216
217bzl_library(
218    name = "pip_compile_bzl",
219    srcs = ["pip_compile.bzl"],
220    deps = [
221        ":deps_bzl",
222        "//python:defs_bzl",
223    ],
224)
225
226bzl_library(
227    name = "pip_repository_bzl",
228    srcs = ["pip_repository.bzl"],
229    deps = [
230        ":attrs_bzl",
231        ":evaluate_markers_bzl",
232        ":parse_requirements_bzl",
233        ":pip_repository_attrs_bzl",
234        ":render_pkg_aliases_bzl",
235        "//python/private:normalize_name_bzl",
236        "//python/private:repo_utils_bzl",
237        "//python/private:text_util_bzl",
238        "@bazel_skylib//lib:sets",
239    ],
240)
241
242bzl_library(
243    name = "pip_repository_attrs_bzl",
244    srcs = ["pip_repository_attrs.bzl"],
245)
246
247bzl_library(
248    name = "pypi_repo_utils_bzl",
249    srcs = ["pypi_repo_utils.bzl"],
250    deps = [
251        "//python/private:repo_utils_bzl",
252        "@bazel_skylib//lib:types",
253    ],
254)
255
256bzl_library(
257    name = "render_pkg_aliases_bzl",
258    srcs = ["render_pkg_aliases.bzl"],
259    deps = [
260        ":generate_group_library_build_bazel_bzl",
261        ":labels_bzl",
262        ":parse_whl_name_bzl",
263        ":whl_target_platforms_bzl",
264        "//python/private:normalize_name_bzl",
265        "//python/private:text_util_bzl",
266    ],
267)
268
269bzl_library(
270    name = "requirements_files_by_platform_bzl",
271    srcs = ["requirements_files_by_platform.bzl"],
272    deps = [
273        ":whl_target_platforms_bzl",
274    ],
275)
276
277bzl_library(
278    name = "simpleapi_download_bzl",
279    srcs = ["simpleapi_download.bzl"],
280    deps = [
281        ":parse_simpleapi_html_bzl",
282        "//python/private:auth_bzl",
283        "//python/private:normalize_name_bzl",
284        "//python/private:text_util_bzl",
285        "@bazel_features//:features",
286    ],
287)
288
289bzl_library(
290    name = "whl_library_alias_bzl",
291    srcs = ["whl_library_alias.bzl"],
292    deps = [
293        ":render_pkg_aliases_bzl",
294        "//python/private:full_version_bzl",
295    ],
296)
297
298bzl_library(
299    name = "whl_library_bzl",
300    srcs = ["whl_library.bzl"],
301    deps = [
302        ":attrs_bzl",
303        ":deps_bzl",
304        ":generate_whl_library_build_bazel_bzl",
305        ":parse_whl_name_bzl",
306        ":patch_whl_bzl",
307        ":pypi_repo_utils_bzl",
308        ":whl_target_platforms_bzl",
309        "//python/private:auth_bzl",
310        "//python/private:envsubst_bzl",
311        "//python/private:is_standalone_interpreter_bzl",
312        "//python/private:repo_utils_bzl",
313    ],
314)
315
316bzl_library(
317    name = "whl_repo_name_bzl",
318    srcs = ["whl_repo_name.bzl"],
319    deps = [
320        ":parse_whl_name_bzl",
321        "//python/private:normalize_name_bzl",
322    ],
323)
324
325bzl_library(
326    name = "whl_target_platforms_bzl",
327    srcs = ["whl_target_platforms.bzl"],
328    deps = [":parse_whl_name_bzl"],
329)
330