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"""Code that support testing of rules_python code.""" 15 16# NOTE: Explicit Label() calls are required so that it resolves in @rules_python 17# context instead of e.g. the @rules_testing context. 18# NOTE: Some labels require str() around Label() because they are passed onto 19# rules_testing or as config_setting values, which don't support Label in some 20# places. 21 22MAC = Label("//tests/support:mac") 23MAC_X86_64 = Label("//tests/support:mac_x86_64") 24LINUX = Label("//tests/support:linux") 25LINUX_X86_64 = Label("//tests/support:linux_x86_64") 26WINDOWS = Label("//tests/support:windows") 27WINDOWS_X86_64 = Label("//tests/support:windows_x86_64") 28 29PY_TOOLCHAINS = str(Label("//tests/support/py_toolchains:all")) 30CC_TOOLCHAIN = str(Label("//tests/support/cc_toolchains:all")) 31CROSSTOOL_TOP = Label("//tests/support/cc_toolchains:cc_toolchain_suite") 32 33# str() around Label() is necessary because rules_testing's config_settings 34# doesn't accept yet Label objects. 35EXEC_TOOLS_TOOLCHAIN = str(Label("//python/config_settings:exec_tools_toolchain")) 36PRECOMPILE = str(Label("//python/config_settings:precompile")) 37PRECOMPILE_ADD_TO_RUNFILES = str(Label("//python/config_settings:precompile_add_to_runfiles")) 38PRECOMPILE_SOURCE_RETENTION = str(Label("//python/config_settings:precompile_source_retention")) 39PYC_COLLECTION = str(Label("//python/config_settings:pyc_collection")) 40PYTHON_VERSION = str(Label("//python/config_settings:python_version")) 41VISIBLE_FOR_TESTING = str(Label("//python/private:visible_for_testing")) 42