blob: 10c4c38f199e8108ebff7b1675babd26ed0fea45 [file] [log] [blame]
Jan Tattermusch7897ae92017-06-07 22:57:36 +02001# Copyright 2016 gRPC authors.
Masood Malekghassemiaff69362016-09-21 15:10:36 -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 Malekghassemiaff69362016-09-21 15:10:36 -07006#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02007# http://www.apache.org/licenses/LICENSE-2.0
Masood Malekghassemiaff69362016-09-21 15:10:36 -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 Malekghassemiaff69362016-09-21 15:10:36 -070014"""Setup module for the GRPC Python package's optional reflection."""
15
16import os
17import sys
18
19import setuptools
20
21# Ensure we're in the proper directory whether or not we're being used by pip.
22os.chdir(os.path.dirname(os.path.abspath(__file__)))
23
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080024# Break import-style to ensure we can actually find our local modules.
Masood Malekghassemiaff69362016-09-21 15:10:36 -070025import grpc_version
26
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080027
28class _NoOpCommand(setuptools.Command):
29 """No-op command."""
30
31 description = ''
32 user_options = []
33
34 def initialize_options(self):
35 pass
36
37 def finalize_options(self):
38 pass
39
40 def run(self):
41 pass
42
43
Ken Payson9c420442017-07-25 12:06:46 -070044CLASSIFIERS = [
45 'Development Status :: 5 - Production/Stable',
46 'Programming Language :: Python',
47 'Programming Language :: Python :: 2',
48 'Programming Language :: Python :: 2.7',
49 'Programming Language :: Python :: 3',
50 'Programming Language :: Python :: 3.4',
51 'Programming Language :: Python :: 3.5',
52 'Programming Language :: Python :: 3.6',
53 'License :: OSI Approved :: Apache Software License',
Ken Paysonf5f5ed02017-08-24 11:46:03 -070054]
Ken Payson9c420442017-07-25 12:06:46 -070055
Ken Payson2fa5f2f2017-02-06 10:27:09 -080056PACKAGE_DIRECTORIES = {
57 '': '.',
58}
Masood Malekghassemiaff69362016-09-21 15:10:36 -070059
Mehrdad Afshari87cd9942018-01-02 14:40:00 -080060INSTALL_REQUIRES = (
61 'protobuf>=3.5.0.post1',
62 'grpcio>={version}'.format(version=grpc_version.VERSION),
63)
Masood Malekghassemiaff69362016-09-21 15:10:36 -070064
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080065try:
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080066 import reflection_commands as _reflection_commands
Mehrdad Afshari90dbd2b2017-11-16 15:21:02 -080067 # we are in the build environment, otherwise the above import fails
Mehrdad Afshari9d1ba2e2017-11-13 14:16:21 -080068 SETUP_REQUIRES = (
69 'grpcio-tools=={version}'.format(version=grpc_version.VERSION),)
70 COMMAND_CLASS = {
71 # Run preprocess from the repository *before* doing any packaging!
72 'preprocess': _reflection_commands.CopyProtoModules,
73 'build_package_protos': _reflection_commands.BuildPackageProtos,
74 }
Mehrdad Afshari90dbd2b2017-11-16 15:21:02 -080075except ImportError:
76 SETUP_REQUIRES = ()
77 COMMAND_CLASS = {
78 # wire up commands to no-op not to break the external dependencies
79 'preprocess': _NoOpCommand,
80 'build_package_protos': _NoOpCommand,
81 }
Masood Malekghassemiaff69362016-09-21 15:10:36 -070082
83setuptools.setup(
84 name='grpcio-reflection',
85 version=grpc_version.VERSION,
Jan Tattermusch4d5c3102017-06-07 10:23:56 +020086 license='Apache License 2.0',
Ken Payson78354302017-03-06 09:28:16 -080087 description='Standard Protobuf Reflection Service for gRPC',
88 author='The gRPC Authors',
89 author_email='grpc-io@googlegroups.com',
Ken Payson9c420442017-07-25 12:06:46 -070090 classifiers=CLASSIFIERS,
Mehrdad Afsharibb3d95b2017-07-10 22:24:28 +000091 url='https://grpc.io',
Masood Malekghassemiaff69362016-09-21 15:10:36 -070092 package_dir=PACKAGE_DIRECTORIES,
93 packages=setuptools.find_packages('.'),
Masood Malekghassemiaff69362016-09-21 15:10:36 -070094 install_requires=INSTALL_REQUIRES,
95 setup_requires=SETUP_REQUIRES,
Masood Malekghassemicc793702017-01-13 19:20:10 -080096 cmdclass=COMMAND_CLASS)