setup.py 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. import os
  16. import os.path
  17. import sys
  18. import setuptools
  19. import grpc_tools.command
  20. PY3 = sys.version_info.major == 3
  21. # Ensure we're in the proper directory whether or not we're being used by pip.
  22. os.chdir(os.path.dirname(os.path.abspath(__file__)))
  23. # Break import-style to ensure we can actually find our in-repo dependencies.
  24. import commands
  25. import grpc_version
  26. LICENSE = 'Apache License 2.0'
  27. PACKAGE_DIRECTORIES = {
  28. '': '.',
  29. }
  30. INSTALL_REQUIRES = (
  31. 'coverage>=4.0', 'enum34>=1.0.4',
  32. 'grpcio>={version}'.format(version=grpc_version.VERSION),
  33. 'grpcio-channelz>={version}'.format(version=grpc_version.VERSION),
  34. 'grpcio-status>={version}'.format(version=grpc_version.VERSION),
  35. 'grpcio-tools>={version}'.format(version=grpc_version.VERSION),
  36. 'grpcio-health-checking>={version}'.format(version=grpc_version.VERSION),
  37. 'oauth2client>=1.4.7', 'protobuf>=3.6.0', 'six>=1.10', 'google-auth>=1.0.0',
  38. 'requests>=2.14.2')
  39. if not PY3:
  40. INSTALL_REQUIRES += ('futures>=2.2.0',)
  41. COMMAND_CLASS = {
  42. # Run `preprocess` *before* doing any packaging!
  43. 'preprocess': commands.GatherProto,
  44. 'build_package_protos': grpc_tools.command.BuildPackageProtos,
  45. 'build_py': commands.BuildPy,
  46. 'run_fork': commands.RunFork,
  47. 'run_interop': commands.RunInterop,
  48. 'test_lite': commands.TestLite,
  49. 'test_gevent': commands.TestGevent,
  50. }
  51. PACKAGE_DATA = {
  52. 'tests.interop': [
  53. 'credentials/ca.pem',
  54. 'credentials/server1.key',
  55. 'credentials/server1.pem',
  56. ],
  57. 'tests.protoc_plugin.protos.invocation_testing': [
  58. 'same.proto',
  59. ],
  60. 'tests.protoc_plugin.protos.invocation_testing.split_messages': [
  61. 'messages.proto',
  62. ],
  63. 'tests.protoc_plugin.protos.invocation_testing.split_services': [
  64. 'services.proto',
  65. ],
  66. 'tests.testing.proto': [
  67. 'requests.proto',
  68. 'services.proto',
  69. ],
  70. 'tests.unit': [
  71. 'credentials/ca.pem',
  72. 'credentials/server1.key',
  73. 'credentials/server1.pem',
  74. ],
  75. 'tests': ['tests.json'],
  76. }
  77. TEST_SUITE = 'tests'
  78. TEST_LOADER = 'tests:Loader'
  79. TEST_RUNNER = 'tests:Runner'
  80. TESTS_REQUIRE = INSTALL_REQUIRES
  81. PACKAGES = setuptools.find_packages('.')
  82. setuptools.setup(
  83. name='grpcio-tests',
  84. version=grpc_version.VERSION,
  85. license=LICENSE,
  86. packages=list(PACKAGES),
  87. package_dir=PACKAGE_DIRECTORIES,
  88. package_data=PACKAGE_DATA,
  89. install_requires=INSTALL_REQUIRES,
  90. cmdclass=COMMAND_CLASS,
  91. tests_require=TESTS_REQUIRE,
  92. test_suite=TEST_SUITE,
  93. test_loader=TEST_LOADER,
  94. test_runner=TEST_RUNNER,
  95. )