python: add debug information for python install

This commit is contained in:
Adrien Béraud committed 2025-09-18 22:19:41 -04:00
1 parent deee57b6dd
commit 9c264e1cad
2 files changed
+34 -10

No files matched your search

+33 -9
View File
@@ -12,17 +12,41 @@ add_custom_target(python
DEPENDS opendht opendht_cpp.pxd opendht.pyx pyproject.toml
${CURRENT_SOURCE_DIR}/opendht/__init__.py
${CURRENT_SOURCE_DIR}/opendht/aio.py)
set(_pip_commands
"${Python3_EXECUTABLE};-m;pip;install;--no-deps;--break-system-packages;${CMAKE_CURRENT_BINARY_DIR}"
"${Python3_EXECUTABLE};-m;pip;install;--no-deps;${CMAKE_CURRENT_BINARY_DIR}"
"pip3;install;--no-deps;--break-system-packages;${CMAKE_CURRENT_BINARY_DIR}"
"pip;install;--no-deps;--break-system-packages;${CMAKE_CURRENT_BINARY_DIR}")
install(CODE [[
execute_process(
COMMAND "${Python3_EXECUTABLE}" -m pip install --no-deps --break-system-packages "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
OUTPUT_VARIABLE _pip_output
ERROR_VARIABLE _pip_output
RESULT_VARIABLE _pip_result)
message(STATUS ${_pip_output})
if(NOT _pip_result EQUAL 0)
message(FATAL_ERROR "pip install failed with code ${_pip_result}")
# Try different pip installation methods
set(_success FALSE)
foreach(_cmd_list ${_pip_commands})
string(REPLACE ";" " " _cmd_str "${_cmd_list}")
message(STATUS "Attempting: ${_cmd_str}")
execute_process(
COMMAND ${_cmd_list}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
OUTPUT_VARIABLE _pip_output
ERROR_VARIABLE _pip_error
RESULT_VARIABLE _pip_result)
if(_pip_result EQUAL 0)
message(STATUS "Successfully installed Python package")
message(STATUS "Output: ${_pip_output}")
set(_success TRUE)
break()
else()
message(WARNING "Command failed with code ${_pip_result}")
message(WARNING "Output: ${_pip_output}")
message(WARNING "Error: ${_pip_error}")
endif()
endforeach()
if(NOT _success)
message(FATAL_ERROR "All pip install attempts failed. Check that pip is available and the wheel was built correctly.")
endif()
]])
if (OPENDHT_TOOLS)
+1 -1
View File
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools", "wheel", "Cython", "build"]
requires = ["setuptools", "wheel", "Cython"]
build-backend = "setuptools.build_meta"
[tool.cibuildwheel]