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/private:util.bzl", "IS_BAZEL_7_OR_HIGHER") # buildifier: disable=bzl-visibility 16load("//tests/support:sh_py_run_test.bzl", "py_reconfig_test", "sh_py_run_test") 17 18_SUPPORTS_BOOTSTRAP_SCRIPT = select({ 19 "@platforms//os:windows": ["@platforms//:incompatible"], 20 "//conditions:default": [], 21}) if IS_BAZEL_7_OR_HIGHER else ["@platforms//:incompatible"] 22 23sh_py_run_test( 24 name = "run_binary_zip_no_test", 25 build_python_zip = "no", 26 py_src = "bin.py", 27 sh_src = "run_binary_zip_no_test.sh", 28) 29 30sh_py_run_test( 31 name = "run_binary_zip_yes_test", 32 build_python_zip = "yes", 33 py_src = "bin.py", 34 sh_src = "run_binary_zip_yes_test.sh", 35) 36 37sh_py_run_test( 38 name = "run_binary_bootstrap_script_zip_yes_test", 39 bootstrap_impl = "script", 40 build_python_zip = "yes", 41 py_src = "bin.py", 42 sh_src = "run_binary_zip_yes_test.sh", 43 target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, 44) 45 46sh_py_run_test( 47 name = "run_binary_bootstrap_script_zip_no_test", 48 bootstrap_impl = "script", 49 build_python_zip = "no", 50 py_src = "bin.py", 51 sh_src = "run_binary_zip_no_test.sh", 52 target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, 53) 54 55py_reconfig_test( 56 name = "sys_path_order_bootstrap_script_test", 57 srcs = ["sys_path_order_test.py"], 58 bootstrap_impl = "script", 59 env = {"BOOTSTRAP": "script"}, 60 imports = ["./site-packages"], 61 main = "sys_path_order_test.py", 62 target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, 63) 64 65py_reconfig_test( 66 name = "sys_path_order_bootstrap_system_python_test", 67 srcs = ["sys_path_order_test.py"], 68 bootstrap_impl = "system_python", 69 env = {"BOOTSTRAP": "system_python"}, 70 imports = ["./site-packages"], 71 main = "sys_path_order_test.py", 72) 73 74sh_py_run_test( 75 name = "inherit_pythonsafepath_env_test", 76 bootstrap_impl = "script", 77 py_src = "bin.py", 78 sh_src = "inherit_pythonsafepath_env_test.sh", 79 target_compatible_with = _SUPPORTS_BOOTSTRAP_SCRIPT, 80) 81