| 1 |
# Copyright 2015 gRPC authors. |
| 2 |
# |
| 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 |
| 6 |
# |
| 7 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
# |
| 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. |
| 14 |
"""A setup module for the gRPC Python package.""" |
| 15 |
|
| 16 |
import multiprocessing |
| 17 |
import os |
| 18 |
import os.path |
| 19 |
import sys |
| 20 |
|
| 21 |
import grpc_tools.command |
| 22 |
import setuptools |
| 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 |
|
| 33 |
LICENSE = 'Apache License 2.0' |
| 34 |
|
| 35 |
PACKAGE_DIRECTORIES = { |
| 36 |
'': '.', |
| 37 |
} |
| 38 |
|
| 39 |
INSTALL_REQUIRES = ( |
| 40 |
'coverage>=4.0', 'grpcio>={version}'.format(version=grpc_version.VERSION), |
| 41 |
'grpcio-channelz>={version}'.format(version=grpc_version.VERSION), |
| 42 |
'grpcio-status>={version}'.format(version=grpc_version.VERSION), |
| 43 |
'grpcio-tools>={version}'.format(version=grpc_version.VERSION), |
| 44 |
'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION), |
| 45 |
'oauth2client>=1.4.7', 'protobuf>=4.21.6', 'google-auth>=1.17.2', |
| 46 |
'requests>=2.14.2') |
| 47 |
|
| 48 |
COMMAND_CLASS = { |
| 49 |
# Run `preprocess` *before* doing any packaging! |
| 50 |
'preprocess': commands.GatherProto, |
| 51 |
'build_package_protos': grpc_tools.command.BuildPackageProtos, |
| 52 |
'build_py': commands.BuildPy, |
| 53 |
'run_fork': commands.RunFork, |
| 54 |
'run_interop': commands.RunInterop, |
| 55 |
'test_lite': commands.TestLite, |
| 56 |
'test_gevent': commands.TestGevent, |
| 57 |
'test_aio': commands.TestAio, |
| 58 |
'test_py3_only': commands.TestPy3Only, |
| 59 |
} |
| 60 |
|
| 61 |
PACKAGE_DATA = { |
| 62 |
'tests.interop': [ |
| 63 |
'credentials/ca.pem', |
| 64 |
'credentials/server1.key', |
| 65 |
'credentials/server1.pem', |
| 66 |
], |
| 67 |
'tests.protoc_plugin.protos.invocation_testing': [ |
| 68 |
'same.proto', 'compiler.proto' |
| 69 |
], |
| 70 |
'tests.protoc_plugin.protos.invocation_testing.split_messages': [ |
| 71 |
'messages.proto', |
| 72 |
], |
| 73 |
'tests.protoc_plugin.protos.invocation_testing.split_services': [ |
| 74 |
'services.proto', |
| 75 |
], |
| 76 |
'tests.testing.proto': [ |
| 77 |
'requests.proto', |
| 78 |
'services.proto', |
| 79 |
], |
| 80 |
'tests.unit': [ |
| 81 |
'credentials/ca.pem', |
| 82 |
'credentials/server1.key', |
| 83 |
'credentials/server1.pem', |
| 84 |
], |
| 85 |
'tests': ['tests.json'], |
| 86 |
} |
| 87 |
|
| 88 |
TEST_SUITE = 'tests' |
| 89 |
TEST_LOADER = 'tests:Loader' |
| 90 |
TEST_RUNNER = 'tests:Runner' |
| 91 |
TESTS_REQUIRE = INSTALL_REQUIRES |
| 92 |
|
| 93 |
PACKAGES = setuptools.find_packages('.') |
| 94 |
|
| 95 |
if __name__ == "__main__": |
| 96 |
multiprocessing.freeze_support() |
| 97 |
setuptools.setup( |
| 98 |
name='grpcio-tests', |
| 99 |
version=grpc_version.VERSION, |
| 100 |
license=LICENSE, |
| 101 |
packages=list(PACKAGES), |
| 102 |
package_dir=PACKAGE_DIRECTORIES, |
| 103 |
package_data=PACKAGE_DATA, |
| 104 |
install_requires=INSTALL_REQUIRES, |
| 105 |
cmdclass=COMMAND_CLASS, |
| 106 |
tests_require=TESTS_REQUIRE, |
| 107 |
test_suite=TEST_SUITE, |
| 108 |
test_loader=TEST_LOADER, |
| 109 |
test_runner=TEST_RUNNER, |
| 110 |
) |