blob: debe14c40e5b19548f2cbb425863f2e533f48578 [file] [log] [blame]
Jan Tattermusch7897ae92017-06-07 22:57:36 +02001# Copyright 2015 gRPC authors.
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -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 Malekghassemi1ff429d2016-06-02 16:39:20 -07006#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02007# http://www.apache.org/licenses/LICENSE-2.0
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -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 Malekghassemi1ff429d2016-06-02 16:39:20 -070014"""A setup module for the gRPC Python package."""
15
16import os
17import os.path
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070018import sys
19
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070020import setuptools
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070021
Masood Malekghassemifb261bf2016-12-12 13:19:31 -080022import grpc_tools.command
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070023
24PY3 = sys.version_info.major == 3
25
26# Ensure we're in the proper directory whether or not we're being used by pip.
27os.chdir(os.path.dirname(os.path.abspath(__file__)))
28
29# Break import-style to ensure we can actually find our in-repo dependencies.
30import commands
31import grpc_version
32
Jan Tattermusch4d5c3102017-06-07 10:23:56 +020033LICENSE = 'Apache License 2.0'
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070034
Ken Payson2fa5f2f2017-02-06 10:27:09 -080035PACKAGE_DIRECTORIES = {
36 '': '.',
37}
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070038
39INSTALL_REQUIRES = (
Ken Payson2fa5f2f2017-02-06 10:27:09 -080040 'coverage>=4.0', 'enum34>=1.0.4', 'futures>=2.2.0',
Ken Payson83489732016-08-18 11:27:47 -070041 '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 Payson937d96d2017-05-10 17:01:38 -070044 'oauth2client>=1.4.7', 'protobuf>=3.3.0', 'six>=1.10', 'google-auth>=1.0.0',
45 'requests>=2.14.2')
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070046
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070047COMMAND_CLASS = {
48 # Run `preprocess` *before* doing any packaging!
49 'preprocess': commands.GatherProto,
Masood Malekghassemifb261bf2016-12-12 13:19:31 -080050 'build_package_protos': grpc_tools.command.BuildPackageProtos,
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070051 'build_py': commands.BuildPy,
52 'run_interop': commands.RunInterop,
53 'test_lite': commands.TestLite
54}
55
56PACKAGE_DATA = {
57 'tests.interop': [
58 'credentials/ca.pem',
59 'credentials/server1.key',
60 'credentials/server1.pem',
61 ],
Ken Payson2fa5f2f2017-02-06 10:27:09 -080062 'tests.protoc_plugin.protos.invocation_testing': [
63 'same.proto',
64 ],
Masood Malekghassemid9539592016-10-20 14:47:14 -070065 '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 Malekghassemi1ff429d2016-06-02 16:39:20 -070070 ],
Nathaniel Manista20109852017-07-28 01:24:52 +000071 'tests.testing.proto': [
72 'requests.proto',
73 'services.proto',
74 ],
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070075 'tests.unit': [
76 'credentials/ca.pem',
77 'credentials/server1.key',
78 'credentials/server1.pem',
79 ],
Masood Malekghassemicc793702017-01-13 19:20:10 -080080 'tests': ['tests.json'],
Masood Malekghassemi1ff429d2016-06-02 16:39:20 -070081}
82
83TEST_SUITE = 'tests'
84TEST_LOADER = 'tests:Loader'
85TEST_RUNNER = 'tests:Runner'
86TESTS_REQUIRE = INSTALL_REQUIRES
87
88PACKAGES = setuptools.find_packages('.')
89
90setuptools.setup(
Masood Malekghassemicc793702017-01-13 19:20:10 -080091 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,)