Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 1 | # Copyright 2015, Google Inc. |
| 2 | # All rights reserved. |
| 3 | # |
| 4 | # Redistribution and use in source and binary forms, with or without |
| 5 | # modification, are permitted provided that the following conditions are |
| 6 | # met: |
| 7 | # |
| 8 | # * Redistributions of source code must retain the above copyright |
| 9 | # notice, this list of conditions and the following disclaimer. |
| 10 | # * Redistributions in binary form must reproduce the above |
| 11 | # copyright notice, this list of conditions and the following disclaimer |
| 12 | # in the documentation and/or other materials provided with the |
| 13 | # distribution. |
| 14 | # * Neither the name of Google Inc. nor the names of its |
| 15 | # contributors may be used to endorse or promote products derived from |
| 16 | # this software without specific prior written permission. |
| 17 | # |
| 18 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 | # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 | # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 | # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 | # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 29 | """A setup module for the gRPC Python package.""" |
| 30 | |
| 31 | import os |
| 32 | import os.path |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 33 | import sys |
| 34 | |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 35 | import setuptools |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 36 | |
Masood Malekghassemi | fb261bf | 2016-12-12 13:19:31 -0800 | [diff] [blame] | 37 | import grpc_tools.command |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 38 | |
| 39 | PY3 = sys.version_info.major == 3 |
| 40 | |
| 41 | # Ensure we're in the proper directory whether or not we're being used by pip. |
| 42 | os.chdir(os.path.dirname(os.path.abspath(__file__))) |
| 43 | |
| 44 | # Break import-style to ensure we can actually find our in-repo dependencies. |
| 45 | import commands |
| 46 | import grpc_version |
| 47 | |
| 48 | LICENSE = '3-clause BSD' |
| 49 | |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 50 | PACKAGE_DIRECTORIES = { |
| 51 | '': '.', |
| 52 | } |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 53 | |
| 54 | INSTALL_REQUIRES = ( |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 55 | 'coverage>=4.0', 'enum34>=1.0.4', 'futures>=2.2.0', |
Ken Payson | 8348973 | 2016-08-18 11:27:47 -0700 | [diff] [blame] | 56 | 'grpcio>={version}'.format(version=grpc_version.VERSION), |
| 57 | 'grpcio-tools>={version}'.format(version=grpc_version.VERSION), |
| 58 | 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), |
Ken Payson | 937d96d | 2017-05-10 17:01:38 -0700 | [diff] [blame] | 59 | 'oauth2client>=1.4.7', 'protobuf>=3.3.0', 'six>=1.10', 'google-auth>=1.0.0', |
| 60 | 'requests>=2.14.2') |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 61 | |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 62 | COMMAND_CLASS = { |
| 63 | # Run `preprocess` *before* doing any packaging! |
| 64 | 'preprocess': commands.GatherProto, |
Masood Malekghassemi | fb261bf | 2016-12-12 13:19:31 -0800 | [diff] [blame] | 65 | 'build_package_protos': grpc_tools.command.BuildPackageProtos, |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 66 | 'build_py': commands.BuildPy, |
| 67 | 'run_interop': commands.RunInterop, |
| 68 | 'test_lite': commands.TestLite |
| 69 | } |
| 70 | |
| 71 | PACKAGE_DATA = { |
| 72 | 'tests.interop': [ |
| 73 | 'credentials/ca.pem', |
| 74 | 'credentials/server1.key', |
| 75 | 'credentials/server1.pem', |
| 76 | ], |
Ken Payson | 2fa5f2f | 2017-02-06 10:27:09 -0800 | [diff] [blame] | 77 | 'tests.protoc_plugin.protos.invocation_testing': [ |
| 78 | 'same.proto', |
| 79 | ], |
Masood Malekghassemi | d953959 | 2016-10-20 14:47:14 -0700 | [diff] [blame] | 80 | 'tests.protoc_plugin.protos.invocation_testing.split_messages': [ |
| 81 | 'messages.proto', |
| 82 | ], |
| 83 | 'tests.protoc_plugin.protos.invocation_testing.split_services': [ |
| 84 | 'services.proto', |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 85 | ], |
| 86 | 'tests.unit': [ |
| 87 | 'credentials/ca.pem', |
| 88 | 'credentials/server1.key', |
| 89 | 'credentials/server1.pem', |
| 90 | ], |
Masood Malekghassemi | cc79370 | 2017-01-13 19:20:10 -0800 | [diff] [blame] | 91 | 'tests': ['tests.json'], |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | TEST_SUITE = 'tests' |
| 95 | TEST_LOADER = 'tests:Loader' |
| 96 | TEST_RUNNER = 'tests:Runner' |
| 97 | TESTS_REQUIRE = INSTALL_REQUIRES |
| 98 | |
| 99 | PACKAGES = setuptools.find_packages('.') |
| 100 | |
| 101 | setuptools.setup( |
Masood Malekghassemi | cc79370 | 2017-01-13 19:20:10 -0800 | [diff] [blame] | 102 | name='grpcio-tests', |
| 103 | version=grpc_version.VERSION, |
| 104 | license=LICENSE, |
| 105 | packages=list(PACKAGES), |
| 106 | package_dir=PACKAGE_DIRECTORIES, |
| 107 | package_data=PACKAGE_DATA, |
| 108 | install_requires=INSTALL_REQUIRES, |
| 109 | cmdclass=COMMAND_CLASS, |
| 110 | tests_require=TESTS_REQUIRE, |
| 111 | test_suite=TEST_SUITE, |
| 112 | test_loader=TEST_LOADER, |
| 113 | test_runner=TEST_RUNNER,) |