1# Copyright 2018 The gRPC Authors 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"""Setup module for the GRPC Python package's status mapping.""" 15 16import os 17 18import setuptools 19 20_PACKAGE_PATH = os.path.realpath(os.path.dirname(__file__)) 21_README_PATH = os.path.join(_PACKAGE_PATH, "README.rst") 22 23# Ensure we're in the proper directory whether or not we're being used by pip. 24os.chdir(os.path.dirname(os.path.abspath(__file__))) 25 26# Break import-style to ensure we can actually find our local modules. 27import grpc_version 28 29 30class _NoOpCommand(setuptools.Command): 31 """No-op command.""" 32 33 description = "" 34 user_options = [] 35 36 def initialize_options(self): 37 pass 38 39 def finalize_options(self): 40 pass 41 42 def run(self): 43 pass 44 45 46CLASSIFIERS = [ 47 "Development Status :: 5 - Production/Stable", 48 "Programming Language :: Python", 49 "Programming Language :: Python :: 3", 50 "Programming Language :: Python :: 3.8", 51 "Programming Language :: Python :: 3.9", 52 "Programming Language :: Python :: 3.10", 53 "Programming Language :: Python :: 3.11", 54 "Programming Language :: Python :: 3.12", 55 "License :: OSI Approved :: Apache Software License", 56] 57 58PACKAGE_DIRECTORIES = { 59 "": ".", 60} 61 62INSTALL_REQUIRES = ( 63 "protobuf>=5.26.1,<6.0dev", 64 "grpcio>={version}".format(version=grpc_version.VERSION), 65 "googleapis-common-protos>=1.5.5", 66) 67 68try: 69 import status_commands as _status_commands 70 71 # we are in the build environment, otherwise the above import fails 72 COMMAND_CLASS = { 73 # Run preprocess from the repository *before* doing any packaging! 74 "preprocess": _status_commands.Preprocess, 75 "build_package_protos": _NoOpCommand, 76 } 77except ImportError: 78 COMMAND_CLASS = { 79 # wire up commands to no-op not to break the external dependencies 80 "preprocess": _NoOpCommand, 81 "build_package_protos": _NoOpCommand, 82 } 83 84setuptools.setup( 85 name="grpcio-status", 86 version=grpc_version.VERSION, 87 description="Status proto mapping for gRPC", 88 long_description=open(_README_PATH, "r").read(), 89 author="The gRPC Authors", 90 author_email="[email protected]", 91 url="https://grpc.io", 92 license="Apache License 2.0", 93 classifiers=CLASSIFIERS, 94 package_dir=PACKAGE_DIRECTORIES, 95 packages=setuptools.find_packages("."), 96 python_requires=">=3.8", 97 install_requires=INSTALL_REQUIRES, 98 cmdclass=COMMAND_CLASS, 99) 100