Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 1 | # Copyright 2015 gRPC authors. |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -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 | 1ff429d | 2016-06-02 16:39:20 -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 | 1ff429d | 2016-06-02 16:39:20 -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 | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 14 | """A setup module for the gRPC Python package.""" |
| 15 | |
| 16 | import os |
| 17 | import os.path |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 18 | import sys |
| 19 | |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 20 | import setuptools |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 21 | |
Masood Malekghassemi | fb261bf | 2016-12-12 13:19:31 -0800 | [diff] [blame] | 22 | import grpc_tools.command |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 23 | |
| 24 | PY3 = sys.version_info.major == 3 |
| 25 | |
| 26 | # Ensure we're in the proper directory whether or not we're being used by pip. |
| 27 | os.chdir(os.path.dirname(os.path.abspath(__file__))) |
| 28 | |
| 29 | # Break import-style to ensure we can actually find our in-repo dependencies. |
| 30 | import commands |
| 31 | import grpc_version |
| 32 | |
Jan Tattermusch | 4d5c310 | 2017-06-07 10:23:56 +0200 | [diff] [blame] | 33 | LICENSE = 'Apache License 2.0' |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 34 | |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 35 | PACKAGE_DIRECTORIES = { |
| 36 | '': '.', |
| 37 | } |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 38 | |
| 39 | INSTALL_REQUIRES = ( |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 40 | 'coverage>=4.0', 'enum34>=1.0.4', 'futures>=2.2.0', |
Ken Payson | 8348973 | 2016-08-18 11:27:47 -0700 | [diff] [blame] | 41 | 'grpcio>={version}'.format(version=grpc_version.VERSION), |
| 42 | 'grpcio-tools>={version}'.format(version=grpc_version.VERSION), |
| 43 | 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), |
Ken Payson | 937d96d | 2017-05-10 17:01:38 -0700 | [diff] [blame] | 44 | 'oauth2client>=1.4.7', 'protobuf>=3.3.0', 'six>=1.10', 'google-auth>=1.0.0', |
| 45 | 'requests>=2.14.2') |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 46 | |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 47 | COMMAND_CLASS = { |
| 48 | # Run `preprocess` *before* doing any packaging! |
| 49 | 'preprocess': commands.GatherProto, |
Masood Malekghassemi | fb261bf | 2016-12-12 13:19:31 -0800 | [diff] [blame] | 50 | 'build_package_protos': grpc_tools.command.BuildPackageProtos, |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 51 | 'build_py': commands.BuildPy, |
| 52 | 'run_interop': commands.RunInterop, |
| 53 | 'test_lite': commands.TestLite |
| 54 | } |
| 55 | |
| 56 | PACKAGE_DATA = { |
| 57 | 'tests.interop': [ |
| 58 | 'credentials/ca.pem', |
| 59 | 'credentials/server1.key', |
| 60 | 'credentials/server1.pem', |
| 61 | ], |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 62 | 'tests.protoc_plugin.protos.invocation_testing': [ |
| 63 | 'same.proto', |
| 64 | ], |
Masood Malekghassemi | d953959 | 2016-10-20 14:47:14 -0700 | [diff] [blame] | 65 | 'tests.protoc_plugin.protos.invocation_testing.split_messages': [ |
| 66 | 'messages.proto', |
| 67 | ], |
| 68 | 'tests.protoc_plugin.protos.invocation_testing.split_services': [ |
| 69 | 'services.proto', |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 70 | ], |
Nathaniel Manista | 2010985 | 2017-07-28 01:24:52 +0000 | [diff] [blame] | 71 | 'tests.testing.proto': [ |
| 72 | 'requests.proto', |
| 73 | 'services.proto', |
| 74 | ], |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 75 | 'tests.unit': [ |
| 76 | 'credentials/ca.pem', |
| 77 | 'credentials/server1.key', |
| 78 | 'credentials/server1.pem', |
| 79 | ], |
Masood Malekghassemi | cc79370 | 2017-01-13 19:20:10 -0800 | [diff] [blame] | 80 | 'tests': ['tests.json'], |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 81 | } |
| 82 | |
| 83 | TEST_SUITE = 'tests' |
| 84 | TEST_LOADER = 'tests:Loader' |
| 85 | TEST_RUNNER = 'tests:Runner' |
| 86 | TESTS_REQUIRE = INSTALL_REQUIRES |
| 87 | |
| 88 | PACKAGES = setuptools.find_packages('.') |
| 89 | |
| 90 | setuptools.setup( |
Masood Malekghassemi | cc79370 | 2017-01-13 19:20:10 -0800 | [diff] [blame] | 91 | name='grpcio-tests', |
| 92 | version=grpc_version.VERSION, |
| 93 | license=LICENSE, |
| 94 | packages=list(PACKAGES), |
| 95 | package_dir=PACKAGE_DIRECTORIES, |
| 96 | package_data=PACKAGE_DATA, |
| 97 | install_requires=INSTALL_REQUIRES, |
| 98 | cmdclass=COMMAND_CLASS, |
| 99 | tests_require=TESTS_REQUIRE, |
| 100 | test_suite=TEST_SUITE, |
| 101 | test_loader=TEST_LOADER, |
| 102 | test_runner=TEST_RUNNER,) |