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. |
| 29 | |
| 30 | """A setup module for the gRPC Python package.""" |
| 31 | |
| 32 | import os |
| 33 | import os.path |
| 34 | import shutil |
| 35 | import sys |
| 36 | |
| 37 | from distutils import core as _core |
| 38 | from distutils import extension as _extension |
| 39 | import setuptools |
| 40 | from setuptools.command import egg_info |
| 41 | |
| 42 | import grpc.tools.command |
| 43 | |
| 44 | PY3 = sys.version_info.major == 3 |
| 45 | |
| 46 | # Ensure we're in the proper directory whether or not we're being used by pip. |
| 47 | os.chdir(os.path.dirname(os.path.abspath(__file__))) |
| 48 | |
| 49 | # Break import-style to ensure we can actually find our in-repo dependencies. |
| 50 | import commands |
| 51 | import grpc_version |
| 52 | |
| 53 | LICENSE = '3-clause BSD' |
| 54 | |
| 55 | PACKAGE_DIRECTORIES = { |
| 56 | '': '.', |
| 57 | } |
| 58 | |
| 59 | INSTALL_REQUIRES = ( |
| 60 | 'coverage>=4.0', |
| 61 | 'enum34>=1.0.4', |
| 62 | 'futures>=2.2.0', |
| 63 | 'grpcio>=0.14.0', |
| 64 | 'grpcio-health-checking>=0.14.0', |
| 65 | 'oauth2client>=1.4.7', |
Ken Payson | e5fd01a | 2016-08-02 12:06:21 -0700 | [diff] [blame^] | 66 | 'protobuf>=3.0.0', |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 67 | 'six>=1.10', |
| 68 | ) |
| 69 | |
| 70 | SETUP_REQUIRES = ( |
| 71 | 'grpcio-tools>=0.14.0', |
| 72 | ) |
| 73 | |
| 74 | COMMAND_CLASS = { |
| 75 | # Run `preprocess` *before* doing any packaging! |
| 76 | 'preprocess': commands.GatherProto, |
| 77 | |
Ken Payson | dd24c1e | 2016-07-13 14:18:33 -0700 | [diff] [blame] | 78 | 'build_package_protos': grpc.tools.command.BuildPackageProtos, |
Masood Malekghassemi | 1ff429d | 2016-06-02 16:39:20 -0700 | [diff] [blame] | 79 | 'build_py': commands.BuildPy, |
| 80 | 'run_interop': commands.RunInterop, |
| 81 | 'test_lite': commands.TestLite |
| 82 | } |
| 83 | |
| 84 | PACKAGE_DATA = { |
| 85 | 'tests.interop': [ |
| 86 | 'credentials/ca.pem', |
| 87 | 'credentials/server1.key', |
| 88 | 'credentials/server1.pem', |
| 89 | ], |
| 90 | 'tests.protoc_plugin': [ |
| 91 | 'protoc_plugin_test.proto', |
| 92 | ], |
| 93 | 'tests.unit': [ |
| 94 | 'credentials/ca.pem', |
| 95 | 'credentials/server1.key', |
| 96 | 'credentials/server1.pem', |
| 97 | ], |
| 98 | 'tests': [ |
| 99 | 'tests.json' |
| 100 | ], |
| 101 | } |
| 102 | |
| 103 | TEST_SUITE = 'tests' |
| 104 | TEST_LOADER = 'tests:Loader' |
| 105 | TEST_RUNNER = 'tests:Runner' |
| 106 | TESTS_REQUIRE = INSTALL_REQUIRES |
| 107 | |
| 108 | PACKAGES = setuptools.find_packages('.') |
| 109 | |
| 110 | setuptools.setup( |
| 111 | name='grpcio-tests', |
| 112 | version=grpc_version.VERSION, |
| 113 | license=LICENSE, |
| 114 | packages=list(PACKAGES), |
| 115 | package_dir=PACKAGE_DIRECTORIES, |
| 116 | package_data=PACKAGE_DATA, |
| 117 | install_requires=INSTALL_REQUIRES, |
| 118 | setup_requires=SETUP_REQUIRES, |
| 119 | cmdclass=COMMAND_CLASS, |
| 120 | tests_require=TESTS_REQUIRE, |
| 121 | test_suite=TEST_SUITE, |
| 122 | test_loader=TEST_LOADER, |
| 123 | test_runner=TEST_RUNNER, |
| 124 | ) |