Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 1 | # Copyright 2015 gRPC authors. |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 2 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 6 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 8 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 14 | """Setup module for the GRPC Python package's optional health checking.""" |
| 15 | |
| 16 | import os |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 17 | |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 18 | import setuptools |
| 19 | |
| 20 | # Ensure we're in the proper directory whether or not we're being used by pip. |
| 21 | os.chdir(os.path.dirname(os.path.abspath(__file__))) |
| 22 | |
Mehrdad Afshari | 9d1ba2e | 2017-11-13 14:16:21 -0800 | [diff] [blame] | 23 | # Break import-style to ensure we can actually find our local modules. |
Ken Payson | dd24c1e | 2016-07-13 14:18:33 -0700 | [diff] [blame] | 24 | import grpc_version |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 25 | |
Mehrdad Afshari | 9d1ba2e | 2017-11-13 14:16:21 -0800 | [diff] [blame] | 26 | |
| 27 | class _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 Payson | 9c42044 | 2017-07-25 12:06:46 -0700 | [diff] [blame] | 43 | CLASSIFIERS = [ |
| 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 Payson | f5f5ed0 | 2017-08-24 11:46:03 -0700 | [diff] [blame] | 53 | ] |
Ken Payson | 9c42044 | 2017-07-25 12:06:46 -0700 | [diff] [blame] | 54 | |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 55 | PACKAGE_DIRECTORIES = { |
| 56 | '': '.', |
| 57 | } |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 58 | |
Mehrdad Afshari | 87cd994 | 2018-01-02 14:40:00 -0800 | [diff] [blame] | 59 | INSTALL_REQUIRES = ( |
| 60 | 'protobuf>=3.5.0.post1', |
| 61 | 'grpcio>={version}'.format(version=grpc_version.VERSION), |
| 62 | ) |
Masood Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 63 | |
Mehrdad Afshari | 9d1ba2e | 2017-11-13 14:16:21 -0800 | [diff] [blame] | 64 | try: |
Mehrdad Afshari | 9d1ba2e | 2017-11-13 14:16:21 -0800 | [diff] [blame] | 65 | import health_commands as _health_commands |
Mehrdad Afshari | 90dbd2b | 2017-11-16 15:21:02 -0800 | [diff] [blame] | 66 | # we are in the build environment, otherwise the above import fails |
Mehrdad Afshari | 9d1ba2e | 2017-11-13 14:16:21 -0800 | [diff] [blame] | 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 | } |
Mehrdad Afshari | 90dbd2b | 2017-11-16 15:21:02 -0800 | [diff] [blame] | 74 | except 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 Malekghassemi | 12dadaf | 2015-08-05 13:30:17 -0700 | [diff] [blame] | 81 | |
| 82 | setuptools.setup( |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 83 | name='grpcio-health-checking', |
Ken Payson | dd24c1e | 2016-07-13 14:18:33 -0700 | [diff] [blame] | 84 | version=grpc_version.VERSION, |
Ken Payson | 7835430 | 2017-03-06 09:28:16 -0800 | [diff] [blame] | 85 | description='Standard Health Checking Service for gRPC', |
| 86 | author='The gRPC Authors', |
| 87 | author_email='grpc-io@googlegroups.com', |
Mehrdad Afshari | bb3d95b | 2017-07-10 22:24:28 +0000 | [diff] [blame] | 88 | url='https://grpc.io', |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 89 | license='Apache License 2.0', |
Ken Payson | 9c42044 | 2017-07-25 12:06:46 -0700 | [diff] [blame] | 90 | classifiers=CLASSIFIERS, |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 91 | package_dir=PACKAGE_DIRECTORIES, |
Ken Payson | dd24c1e | 2016-07-13 14:18:33 -0700 | [diff] [blame] | 92 | packages=setuptools.find_packages('.'), |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 93 | install_requires=INSTALL_REQUIRES, |
| 94 | setup_requires=SETUP_REQUIRES, |
Masood Malekghassemi | cc79370 | 2017-01-13 19:20:10 -0800 | [diff] [blame] | 95 | cmdclass=COMMAND_CLASS) |