blob: 60d309ec65037dc17e373f927ce8cc2b54613e4b [file] [log] [blame]
Jan Tattermusch7897ae92017-06-07 22:57:36 +02001# Copyright 2015 gRPC authors.
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -07002#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02003# 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
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -07006#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02007# http://www.apache.org/licenses/LICENSE-2.0
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -07008#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02009# 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.
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070014"""Setup module for the GRPC Python package's optional health checking."""
15
16import os
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070017
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070018import 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
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080023# Break import-style to ensure we can actually find our local modules.
Ken Paysondd24c1e2016-07-13 14:18:33 -070024import grpc_version
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070025
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080026
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
Ken Payson9c420442017-07-25 12:06:46 -070043CLASSIFIERS = [
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',
Ken Paysonf5f5ed02017-08-24 11:46:03 -070053]
Ken Payson9c420442017-07-25 12:06:46 -070054
Ken Payson2fa5f2f2017-02-06 10:27:09 -080055PACKAGE_DIRECTORIES = {
56 '': '.',
57}
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070058
Mehrdad Afshari87cd9942018-01-02 14:40:00 -080059INSTALL_REQUIRES = (
60 'protobuf>=3.5.0.post1',
61 'grpcio>={version}'.format(version=grpc_version.VERSION),
62)
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070063
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080064try:
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080065 import health_commands as _health_commands
Mehrdad Afshari90dbd2b2017-11-16 15:21:02 -080066 # we are in the build environment, otherwise the above import fails
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080067 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 }
Mehrdad Afshari90dbd2b2017-11-16 15:21:02 -080074except 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 }
Masood Malekghassemi12dadaf2015-08-05 13:30:17 -070081
82setuptools.setup(
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070083 name='grpcio-health-checking',
Ken Paysondd24c1e2016-07-13 14:18:33 -070084 version=grpc_version.VERSION,
Ken Payson78354302017-03-06 09:28:16 -080085 description='Standard Health Checking Service for gRPC',
86 author='The gRPC Authors',
87 author_email='grpc-io@googlegroups.com',
Mehrdad Afsharibb3d95b2017-07-10 22:24:28 +000088 url='https://grpc.io',
Jan Tattermusch4d5c3102017-06-07 10:23:56 +020089 license='Apache License 2.0',
Ken Payson9c420442017-07-25 12:06:46 -070090 classifiers=CLASSIFIERS,
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070091 package_dir=PACKAGE_DIRECTORIES,
Ken Paysondd24c1e2016-07-13 14:18:33 -070092 packages=setuptools.find_packages('.'),
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070093 install_requires=INSTALL_REQUIRES,
94 setup_requires=SETUP_REQUIRES,
Masood Malekghassemicc793702017-01-13 19:20:10 -080095 cmdclass=COMMAND_CLASS)