Skip to content

Commit

Permalink
Disambiguate fpp error messages. Fixes: #2618 (#2620)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeStarch authored Mar 26, 2024
1 parent 00eed9f commit 55adfb5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
11 changes: 8 additions & 3 deletions cmake/autocoder/fpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,19 @@ function(locate_fpp_tools)
continue()
endif()
message(STATUS "[fpp-tools] ${${TOOL}} version ${CMAKE_MATCH_1} not expected version ${FPP_VERSION}")
set(FPP_REINSTALL_ERROR_MESSAGE
"fpp-tools version incompatible. Found ${CMAKE_MATCH_1}, expected ${FPP_VERSION}." PARENT_SCOPE
)
elseif(OUTPUT_TEXT MATCHES "requires 'java'")
set(FPP_ERROR_MESSAGE
"fpp-tools version incompatible. Found ${CMAKE_MATCH_1}, expected ${FPP_VERSION}" PARENT_SCOPE
"fpp tools require 'java'. Please install 'java' and ensure it is on your PATH." PARENT_SCOPE
)
else()
message(STATUS "[fpp-tools] ${PROGRAM} appears corrupt.")
message(STATUS "[fpp-tools] ${PROGRAM} installed incorrectly.")
set(FPP_REINSTALL_ERROR_MESSAGE "fpp tools installed incorrectly." PARENT_SCOPE)
endif()
else()
message(STATUS "[fpp-tools] Could not find ${PROGRAM}")
message(STATUS "[fpp-tools] Could not find ${PROGRAM}.")
endif()
set(FPP_FOUND FALSE PARENT_SCOPE)
return()
Expand Down
9 changes: 6 additions & 3 deletions cmake/required.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ find_program(FPUTIL NAMES fprime-util)

locate_fpp_tools()

set(TO_INSTALL_MESSAGE "Install with:\n 'pip install -r \"${FPRIME_FRAMEWORK_PATH}/requirements.txt\"'")

set(FRAGMENT "pip install -r \"${FPRIME_FRAMEWORK_PATH}/requirements.txt\"")
set(TO_INSTALL_MESSAGE "Install with:\n '${FRAGMENT}'")
set(TO_REINSTALL "Reinstall with:\n '${FRAGMENT} -U --force-reinstall'")
# Check python was found
if (NOT FPUTIL)
message(FATAL_ERROR " fprime-util was not found. ${TO_INSTALL_MESSAGE}")
elseif (NOT PYTHON)
message(FATAL_ERROR " python3 was not found. Please see: https://www.python.org/downloads/")
elseif (DEFINED FPP_ERROR_MESSAGE)
message(FATAL_ERROR " ${FPP_ERROR_MESSAGE}. ${TO_INSTALL_MESSAGE}")
message(FATAL_ERROR " ${FPP_ERROR_MESSAGE}")
elseif (DEFINED FPP_REINSTALL_ERROR_MESSAGE)
message(FATAL_ERROR " ${FPP_REINSTALL_ERROR_MESSAGE}. ${TO_REINSTALL}")
elseif(NOT FPP_FOUND)
message(FATAL_ERROR " fpp tools not found. ${TO_INSTALL_MESSAGE}")
endif()
Expand Down

0 comments on commit 55adfb5

Please sign in to comment.