build.ym 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. {% extends '//builtin/bag.ym' %}
  2. {% block ya_module_type %}PY3_LIBRARY{% endblock %}
  3. {% block current_version %}4.22.5{% endblock %}
  4. {% block current_url %}
  5. https://github.com/protocolbuffers/protobuf/archive/refs/tags/v{{self.version().strip()}}.tar.gz
  6. {% endblock %}
  7. {% block patch_source %}
  8. {{super()}}
  9. rm -rf CMakeLists.txt
  10. (find . -type f -name '*_test.py') | while read l; do
  11. rm -rf ${l}
  12. done
  13. rm -rf python/google/protobuf/internal/import_test_package
  14. rm -rf python/google/protobuf/internal/test_util.py
  15. {% endblock %}
  16. {% block ya_make %}
  17. PEERDIR(
  18. contrib/libs/protobuf
  19. contrib/libs/protobuf/builtin_proto/protos_from_protobuf
  20. contrib/libs/protobuf/builtin_proto/protos_from_protoc
  21. contrib/libs/python
  22. contrib/restricted/abseil-cpp-tstring/y_absl/strings
  23. contrib/restricted/abseil-cpp-tstring/y_absl/log
  24. )
  25. NO_LINT()
  26. ADDINCL(contrib/python/protobuf/py3)
  27. CFLAGS(-DPYTHON_PROTO2_CPP_IMPL_V2)
  28. INCLUDE(ya.make.inc)
  29. PY_REGISTER(
  30. google.protobuf.internal._api_implementation
  31. google.protobuf.pyext._message
  32. )
  33. {% endblock %}
  34. {% block prepare_yamake %}
  35. {{super()}}
  36. cd ${SRC}/python/google
  37. (
  38. echo 'PY_SRCS('
  39. echo ' TOP_LEVEL'
  40. find . -type f -name '*.py' | sed -En 's|\.\/| google\/|p' | env LANG=C sort
  41. echo ')'
  42. ) > ya.make.inc
  43. cd ${SRC}/python/google
  44. (
  45. echo 'SRCS('
  46. find . -type f -name '*.cc' | sed -En 's|\.\/| google\/|p' | env LANG=C sort
  47. echo ')'
  48. ) >> ya.make.inc
  49. cd -
  50. {% endblock %}
  51. {% block move_to_output %}
  52. {{super()}}
  53. cd ${SRC}/python/google
  54. (
  55. find . -type f -name '*.cc'
  56. find . -type f -name '*.h'
  57. find . -type f -name '*.py'
  58. ) | while read l; do
  59. install -v -D -m 0644 ${l} ${OUTPUT}/google/${l}
  60. done
  61. cp ya.make.inc ${OUTPUT}/
  62. {% endblock %}