Skip to content

Commit aa292e8

Browse files
authored
Merge pull request ceph#61089 from pecastro/mgr_proto_build_generation
pybind/mgr: Protobuffer file generation for grpc deps. Reviewed-by: baum <NOT@FOUND> Reviewed-by: ceph-jenkins <NOT@FOUND> Reviewed-by: Ernesto Puerta <[email protected]> Reviewed-by: Nizamudeen A <[email protected]>
2 parents 058003e + 37e6333 commit aa292e8

File tree

8 files changed

+38
-5331
lines changed

8 files changed

+38
-5331
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,8 @@ src/pybind/rbd/rbd.egg-info/
9797
src/pybind/rgw/build/
9898
src/pybind/rgw/rgw.c
9999
src/pybind/rgw/rgw.egg-info/
100+
101+
# GRPC protobuff file generation #PR 61089
102+
src/pybind/mgr/dashboard/services/proto/gateway.proto
103+
src/pybind/mgr/dashboard/services/proto/gateway_pb2.py
104+
src/pybind/mgr/dashboard/services/proto/gateway_pb2_grpc.py

src/nvmeof/gateway

Submodule gateway updated 97 files

src/pybind/mgr/dashboard/CMakeLists.txt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
# Required for building the dashboard grpc protos at build time
2+
set(CEPH_GRPC_VIRTUALENV ${CEPH_BUILD_VIRTUALENV}/ceph-grpc-virtualenv)
3+
set(CEPH_NVME_GATEWAY_PROTO_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/nvmeof/gateway/control/proto)
4+
5+
add_custom_command(
6+
OUTPUT ${CEPH_GRPC_VIRTUALENV}/lib/python*/site-packages/grpc_tools
7+
COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${Python3_EXECUTABLE} ${CEPH_GRPC_VIRTUALENV}
8+
COMMAND ${CEPH_GRPC_VIRTUALENV}/bin/pip install grpcio-tools
9+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
10+
COMMENT "grpcio-tools is being installed")
11+
12+
# protobuffer files generation
13+
add_custom_command(
14+
OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2.py" "${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2_grpc.py"
15+
COMMAND cp ${CEPH_NVME_GATEWAY_PROTO_DIR}/gateway.proto dashboard/services/proto/gateway.proto
16+
COMMAND . ${CEPH_GRPC_VIRTUALENV}/bin/activate && ${CEPH_GRPC_VIRTUALENV}/bin/python -m grpc_tools.protoc --proto_path=. --python_out=. --grpc_python_out=. dashboard/services/proto/gateway.proto && deactivate
17+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..
18+
DEPENDS ${CEPH_NVME_GATEWAY_PROTO_DIR}/gateway.proto ${CEPH_GRPC_VIRTUALENV}/lib/python*/site-packages/grpc_tools
19+
COMMENT "proto generation for grpc deps")
20+
add_custom_target(mgr-dashboard-services-deps
21+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2.py ${CMAKE_CURRENT_SOURCE_DIR}/services/proto/gateway_pb2_grpc.py
22+
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
23+
24+
add_custom_target(mgr-dashboard-services-build
25+
ALL
26+
DEPENDS mgr-dashboard-services-deps)
27+
28+
add_dependencies(tests mgr-dashboard-services-build)
29+
130
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
231
DESTINATION ${CEPH_INSTALL_DATADIR}/mgr
332
${mgr_module_install_excludes}
@@ -14,6 +43,7 @@ if(WITH_MGR_DASHBOARD_FRONTEND)
1443
add_tox_test(mgr-dashboard-check TOX_ENVS check)
1544
add_tox_test(mgr-dashboard-openapi TOX_ENVS openapi-check)
1645
endif()
46+
1747
else()
1848
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/frontend/dist)
1949
# prebuilt

src/pybind/mgr/dashboard/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ pyyaml
1111
natsort
1212
setuptools
1313
jsonpatch
14-
grpcio==1.46.5
15-
grpcio-tools==1.46.5
14+
grpcio
15+
grpcio-tools

src/pybind/mgr/dashboard/services/proto/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)