xref: /aosp_15_r20/external/grpc-grpc/tools/distrib/python/xds_protos/setup.py (revision cc02d7e222339f7a4f6ba5f422e6413f4bd931f2)
1#! /usr/bin/env python3
2# Copyright 2021 The gRPC Authors
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15"""A PyPI package for xDS protos generated Python code."""
16
17import os
18
19import setuptools
20
21import grpc_version
22
23WORK_DIR = os.path.dirname(os.path.abspath(__file__))
24
25# Ensure we're in the proper directory whether or not we're being used by pip.
26os.chdir(WORK_DIR)
27
28EXCLUDE_PYTHON_FILES = ["generated_file_import_test.py", "build.py"]
29
30# Use setuptools to build Python package
31with open(os.path.join(WORK_DIR, "README.rst"), "r") as f:
32    LONG_DESCRIPTION = f.read()
33PACKAGES = setuptools.find_packages(where=".", exclude=EXCLUDE_PYTHON_FILES)
34CLASSIFIERS = [
35    "Development Status :: 3 - Alpha",
36    "Programming Language :: Python",
37    "Programming Language :: Python :: 3",
38    "License :: OSI Approved :: Apache Software License",
39]
40INSTALL_REQUIRES = [
41    "grpcio>=1.49.0",
42    "protobuf>=5.26.1,<6.0dev",
43]
44
45SETUP_REQUIRES = INSTALL_REQUIRES + ["grpcio-tools>=1.49.0"]
46
47setuptools.setup(
48    name="xds-protos",
49    version=grpc_version.VERSION,
50    packages=PACKAGES,
51    description="Generated Python code from envoyproxy/data-plane-api",
52    long_description_content_type="text/x-rst",
53    long_description=LONG_DESCRIPTION,
54    author="The gRPC Authors",
55    author_email="[email protected]",
56    url="https://grpc.io",
57    license="Apache License 2.0",
58    python_requires=">=3.8",
59    install_requires=INSTALL_REQUIRES,
60    setup_requires=SETUP_REQUIRES,
61    classifiers=CLASSIFIERS,
62)
63