xref: /aosp_15_r20/external/bazelbuild-rules_python/tests/pycross/BUILD.bazel (revision 60517a1edbc8ecf509223e9af94a7adec7d736b8)
1# Copyright 2023 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_test")
16load("//third_party/rules_pycross/pycross/private:wheel_library.bzl", "py_wheel_library")  # buildifier: disable=bzl-visibility
17
18py_wheel_library(
19    name = "extracted_wheel_for_testing",
20    wheel = "@wheel_for_testing//file",
21)
22
23py_test(
24    name = "py_wheel_library_test",
25    srcs = [
26        "py_wheel_library_test.py",
27    ],
28    data = [
29        ":extracted_wheel_for_testing",
30    ],
31    deps = [
32        "//python/runfiles",
33    ],
34)
35
36py_wheel_library(
37    name = "patched_extracted_wheel_for_testing",
38    patch_args = [
39        "-p1",
40    ],
41    patch_tool = "patch",
42    patches = [
43        "0001-Add-new-file-for-testing-patch-support.patch",
44    ],
45    target_compatible_with = select({
46        # We don't have `patch` available on the Windows CI machines.
47        "@platforms//os:windows": ["@platforms//:incompatible"],
48        "//conditions:default": [],
49    }),
50    wheel = "@wheel_for_testing//file",
51)
52
53py_test(
54    name = "patched_py_wheel_library_test",
55    srcs = [
56        "patched_py_wheel_library_test.py",
57    ],
58    data = [
59        ":patched_extracted_wheel_for_testing",
60    ],
61    deps = [
62        "//python/runfiles",
63    ],
64)
65