1*60517a1eSAndroid Build Coastguard Worker# Copyright 2019 The Bazel Authors. All rights reserved. 2*60517a1eSAndroid Build Coastguard Worker# 3*60517a1eSAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License"); 4*60517a1eSAndroid Build Coastguard Worker# you may not use this file except in compliance with the License. 5*60517a1eSAndroid Build Coastguard Worker# You may obtain a copy of the License at 6*60517a1eSAndroid Build Coastguard Worker# 7*60517a1eSAndroid Build Coastguard Worker# http://www.apache.org/licenses/LICENSE-2.0 8*60517a1eSAndroid Build Coastguard Worker# 9*60517a1eSAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software 10*60517a1eSAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS, 11*60517a1eSAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12*60517a1eSAndroid Build Coastguard Worker# See the License for the specific language governing permissions and 13*60517a1eSAndroid Build Coastguard Worker# limitations under the License. 14*60517a1eSAndroid Build Coastguard Worker 15*60517a1eSAndroid Build Coastguard Workerload("//python:defs.bzl", "py_library") 16*60517a1eSAndroid Build Coastguard Workerload("//python:packaging.bzl", "py_wheel") 17*60517a1eSAndroid Build Coastguard Workerload("//python/private:bzlmod_enabled.bzl", "BZLMOD_ENABLED") 18*60517a1eSAndroid Build Coastguard Worker 19*60517a1eSAndroid Build Coastguard Workerfilegroup( 20*60517a1eSAndroid Build Coastguard Worker name = "distribution", 21*60517a1eSAndroid Build Coastguard Worker srcs = glob(["**"]), 22*60517a1eSAndroid Build Coastguard Worker visibility = ["//python:__pkg__"], 23*60517a1eSAndroid Build Coastguard Worker) 24*60517a1eSAndroid Build Coastguard Worker 25*60517a1eSAndroid Build Coastguard Workerpy_library( 26*60517a1eSAndroid Build Coastguard Worker name = "runfiles", 27*60517a1eSAndroid Build Coastguard Worker srcs = [ 28*60517a1eSAndroid Build Coastguard Worker "__init__.py", 29*60517a1eSAndroid Build Coastguard Worker "runfiles.py", 30*60517a1eSAndroid Build Coastguard Worker ], 31*60517a1eSAndroid Build Coastguard Worker data = ["py.typed"], 32*60517a1eSAndroid Build Coastguard Worker imports = [ 33*60517a1eSAndroid Build Coastguard Worker # Add the repo root so `import python.runfiles.runfiles` works. This makes it agnostic 34*60517a1eSAndroid Build Coastguard Worker # to the --experimental_python_import_all_repositories setting. 35*60517a1eSAndroid Build Coastguard Worker "../..", 36*60517a1eSAndroid Build Coastguard Worker ], 37*60517a1eSAndroid Build Coastguard Worker visibility = ["//visibility:public"], 38*60517a1eSAndroid Build Coastguard Worker) 39*60517a1eSAndroid Build Coastguard Worker 40*60517a1eSAndroid Build Coastguard Worker# This can be manually tested by running tests/runfiles/runfiles_wheel_integration_test.sh 41*60517a1eSAndroid Build Coastguard Worker# We ought to have an automated integration test for it, too. 42*60517a1eSAndroid Build Coastguard Worker# see https://github.com/bazelbuild/rules_python/issues/1002 43*60517a1eSAndroid Build Coastguard Workerpy_wheel( 44*60517a1eSAndroid Build Coastguard Worker name = "wheel", 45*60517a1eSAndroid Build Coastguard Worker # From https://pypi.org/classifiers/ 46*60517a1eSAndroid Build Coastguard Worker classifiers = [ 47*60517a1eSAndroid Build Coastguard Worker "Development Status :: 5 - Production/Stable", 48*60517a1eSAndroid Build Coastguard Worker "License :: OSI Approved :: Apache Software License", 49*60517a1eSAndroid Build Coastguard Worker ], 50*60517a1eSAndroid Build Coastguard Worker description_file = "README.md", 51*60517a1eSAndroid Build Coastguard Worker dist_folder = "dist", 52*60517a1eSAndroid Build Coastguard Worker distribution = "bazel_runfiles", 53*60517a1eSAndroid Build Coastguard Worker homepage = "https://github.com/bazelbuild/rules_python", 54*60517a1eSAndroid Build Coastguard Worker python_requires = ">=3.7", 55*60517a1eSAndroid Build Coastguard Worker strip_path_prefixes = ["python"], 56*60517a1eSAndroid Build Coastguard Worker twine = None if BZLMOD_ENABLED else "@rules_python_publish_deps_twine//:pkg", 57*60517a1eSAndroid Build Coastguard Worker # this can be replaced by building with --stamp --embed_label=1.2.3 58*60517a1eSAndroid Build Coastguard Worker version = "{BUILD_EMBED_LABEL}", 59*60517a1eSAndroid Build Coastguard Worker visibility = ["//visibility:public"], 60*60517a1eSAndroid Build Coastguard Worker deps = [":runfiles"], 61*60517a1eSAndroid Build Coastguard Worker) 62