blob: 658994d7805537c4ba0578290ba0df90d073d5da [file] [log] [blame]
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -07001# 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 Malekghassemi1ff429d2016-06-02 16:39:20 -070029"""A setup module for the gRPC Python package."""
30
31import os
32import os.path
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070033import sys
34
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070035import setuptools
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070036
Masood Malekghassemifb261bf2016-12-12 13:19:31 -080037import grpc_tools.command
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070038
39PY3 = sys.version_info.major == 3
40
41# Ensure we're in the proper directory whether or not we're being used by pip.
42os.chdir(os.path.dirname(os.path.abspath(__file__)))
43
44# Break import-style to ensure we can actually find our in-repo dependencies.
45import commands
46import grpc_version
47
48LICENSE = '3-clause BSD'
49
Ken Payson2fa5f2f2017-02-06 10:27:09 -080050PACKAGE_DIRECTORIES = {
51 '': '.',
52}
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070053
54INSTALL_REQUIRES = (
Ken Payson2fa5f2f2017-02-06 10:27:09 -080055 'coverage>=4.0', 'enum34>=1.0.4', 'futures>=2.2.0',
Ken Payson83489732016-08-18 11:27:47 -070056 '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 Payson937d96d2017-05-10 17:01:38 -070059 'oauth2client>=1.4.7', 'protobuf>=3.3.0', 'six>=1.10', 'google-auth>=1.0.0',
60 'requests>=2.14.2')
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070061
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070062COMMAND_CLASS = {
63 # Run `preprocess` *before* doing any packaging!
64 'preprocess': commands.GatherProto,
Masood Malekghassemifb261bf2016-12-12 13:19:31 -080065 'build_package_protos': grpc_tools.command.BuildPackageProtos,
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070066 'build_py': commands.BuildPy,
67 'run_interop': commands.RunInterop,
68 'test_lite': commands.TestLite
69}
70
71PACKAGE_DATA = {
72 'tests.interop': [
73 'credentials/ca.pem',
74 'credentials/server1.key',
75 'credentials/server1.pem',
76 ],
Ken Payson2fa5f2f2017-02-06 10:27:09 -080077 'tests.protoc_plugin.protos.invocation_testing': [
78 'same.proto',
79 ],
Masood Malekghassemid9539592016-10-20 14:47:14 -070080 '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 Malekghassemi1ff429d2016-06-02 16:39:20 -070085 ],
86 'tests.unit': [
87 'credentials/ca.pem',
88 'credentials/server1.key',
89 'credentials/server1.pem',
90 ],
Masood Malekghassemicc793702017-01-13 19:20:10 -080091 'tests': ['tests.json'],
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070092}
93
94TEST_SUITE = 'tests'
95TEST_LOADER = 'tests:Loader'
96TEST_RUNNER = 'tests:Runner'
97TESTS_REQUIRE = INSTALL_REQUIRES
98
99PACKAGES = setuptools.find_packages('.')
100
101setuptools.setup(
Masood Malekghassemicc793702017-01-13 19:20:10 -0800102 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,)