Skip to content

Commit 91e4e94

Browse files
committed
CMake: fix --help doesn't work when building without python3
1 parent 1504e26 commit 91e4e94

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,15 @@ endfunction(fastfetch_load_text)
221221

222222
find_package(Python)
223223
if(Python_FOUND)
224-
# Minify JSON string. `io.open(0,encoding='utf-8')` is needed to avoid encoding issues on Windows
225224
execute_process(COMMAND ${Python_EXECUTABLE} -c "import json,sys;json.dump(json.load(sys.stdin),sys.stdout,separators=(',',':'))"
226225
INPUT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/src/data/help.json"
227226
OUTPUT_VARIABLE DATATEXT_JSON_HELP)
227+
if(DATATEXT_JSON_HELP STREQUAL "")
228+
message(ERROR "DATATEXT_JSON_HELP is empty, which should not happen!")
229+
endif()
228230
else()
229-
file(READ "src/data/help.json" TEMP)
231+
message(STATUS "Python3 is not found, 'help.json' will not be minified")
232+
file(READ "src/data/help.json" DATATEXT_JSON_HELP)
230233
endif()
231234

232235
fastfetch_encode_c_string("${DATATEXT_JSON_HELP}" DATATEXT_JSON_HELP)

0 commit comments

Comments
 (0)