Skip to content

Commit

Permalink
fix: grpcio_tools not installed
Browse files Browse the repository at this point in the history
At a first glance this seems like the corresponding pip package is not
installed, however this is not the case. To check for the protoc compiler
in the CMake file,`python3 -m grpc_tools.protoc' is called and
'Missing input file' is expected as the output. With any other output
the build will fail.

Due to a deprecation warning in pkg_resources Python package the output is different
from the expected, although the package is installed. There as been
a fix from Google, however it does only apply for Python verions >= 3.9
grpc/grpc@eae9c55

The implemented solution is to split the string into a list (after each \n) and
get the first element to retrieve the expected output. This will fix the
build, but the deprecation warnings are still printed
  • Loading branch information
Julian Arkenau authored and Mark-Niemeyer committed Sep 6, 2024
1 parent f3b4ac1 commit b96fb2b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion seerep_com/cmake/ProtobufGenerateGrpcPython.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,21 @@ function(GRPC_GENERATE_PYTHON SRCS)
ERROR_VARIABLE _pygrpc_output
)

if(NOT (${_pygrpc_output} STREQUAL "Missing input file.\n"))
string(
REPLACE "\n"
";"
_pygrpc_output
${_pygrpc_output}
)

list(
GET
_pygrpc_output
0
_pygrpc_output
)

if(NOT (${_pygrpc_output} STREQUAL "Missing input file."))
message(
SEND_ERROR
"Error: grpcio_tools not installed\ntry: sudo pip install grpcio_tools"
Expand Down

0 comments on commit b96fb2b

Please sign in to comment.