1# Copyright 2015 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 optional health checking.""" 15 16import os 17 18import setuptools 19 20# Ensure we're in the proper directory whether or not we're being used by pip. 21os.chdir(os.path.dirname(os.path.abspath(__file__))) 22 23# Break import-style to ensure we can actually find our local modules. 24import grpc_version 25 26 27class _NoOpCommand(setuptools.Command): 28 """No-op command.""" 29 30 description = '' 31 user_options = [] 32 33 def initialize_options(self): 34 pass 35 36 def finalize_options(self): 37 pass 38 39 def run(self): 40 pass 41 42 43CLASSIFIERS = [ 44 'Development Status :: 5 - Production/Stable', 45 'Programming Language :: Python', 46 'Programming Language :: Python :: 2', 47 'Programming Language :: Python :: 2.7', 48 'Programming Language :: Python :: 3', 49 'Programming Language :: Python :: 3.4', 50 'Programming Language :: Python :: 3.5', 51 'Programming Language :: Python :: 3.6', 52 'License :: OSI Approved :: Apache Software License', 53] 54 55PACKAGE_DIRECTORIES = { 56 '': '.', 57} 58 59INSTALL_REQUIRES = ( 60 'protobuf>=3.6.0', 61 'grpcio>={version}'.format(version=grpc_version.VERSION), 62) 63 64try: 65 import health_commands as _health_commands 66 # we are in the build environment, otherwise the above import fails 67 SETUP_REQUIRES = ( 68 'grpcio-tools=={version}'.format(version=grpc_version.VERSION),) 69 COMMAND_CLASS = { 70 # Run preprocess from the repository *before* doing any packaging! 71 'preprocess': _health_commands.CopyProtoModules, 72 'build_package_protos': _health_commands.BuildPackageProtos, 73 } 74except ImportError: 75 SETUP_REQUIRES = () 76 COMMAND_CLASS = { 77 # wire up commands to no-op not to break the external dependencies 78 'preprocess': _NoOpCommand, 79 'build_package_protos': _NoOpCommand, 80 } 81 82setuptools.setup( 83 name='grpcio-health-checking', 84 version=grpc_version.VERSION, 85 description='Standard Health Checking Service for gRPC', 86 author='The gRPC Authors', 87 author_email='grpc-io@googlegroups.com', 88 url='https://grpc.io', 89 license='Apache License 2.0', 90 classifiers=CLASSIFIERS, 91 package_dir=PACKAGE_DIRECTORIES, 92 packages=setuptools.find_packages('.'), 93 install_requires=INSTALL_REQUIRES, 94 setup_requires=SETUP_REQUIRES, 95 cmdclass=COMMAND_CLASS) 96