setup.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. """A setup module for the GRPC Python package."""
  30. from distutils import core as _core
  31. _EXTENSION_SOURCES = (
  32. 'src/_adapter/_c.c',
  33. 'src/_adapter/_call.c',
  34. 'src/_adapter/_channel.c',
  35. 'src/_adapter/_completion_queue.c',
  36. 'src/_adapter/_error.c',
  37. 'src/_adapter/_server.c',
  38. 'src/_adapter/_server_credentials.c',
  39. )
  40. _EXTENSION_INCLUDE_DIRECTORIES = (
  41. 'src',
  42. # TODO(nathaniel): Can this path specification be made to work?
  43. #'../../include',
  44. )
  45. _EXTENSION_LIBRARIES = (
  46. 'gpr',
  47. 'grpc',
  48. )
  49. _EXTENSION_LIBRARY_DIRECTORIES = (
  50. # TODO(nathaniel): Can this path specification be made to work?
  51. #'../../libs/dbg',
  52. )
  53. _EXTENSION_MODULE = _core.Extension(
  54. '_adapter._c', sources=list(_EXTENSION_SOURCES),
  55. include_dirs=_EXTENSION_INCLUDE_DIRECTORIES,
  56. libraries=_EXTENSION_LIBRARIES,
  57. library_dirs=_EXTENSION_LIBRARY_DIRECTORIES)
  58. _PACKAGES=(
  59. '_adapter',
  60. '_framework',
  61. '_framework.base',
  62. '_framework.base.packets',
  63. '_framework.common',
  64. '_framework.face',
  65. '_framework.face.testing',
  66. '_framework.foundation',
  67. '_junkdrawer',
  68. )
  69. _PACKAGE_DIRECTORIES = {
  70. '_adapter': 'src/_adapter',
  71. '_framework': 'src/_framework',
  72. '_junkdrawer': 'src/_junkdrawer',
  73. }
  74. _core.setup(
  75. name='grpc', version='0.0.1',
  76. ext_modules=[_EXTENSION_MODULE], packages=_PACKAGES,
  77. package_dir=_PACKAGE_DIRECTORIES)