python: don't guard with DFSG_BUILD; we use USE_PYTHON

This commit is contained in:
nick black 2020-04-25 18:06:02 -04:00
parent f92a5805bd
commit 2c98639005
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -604,43 +604,41 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion COMPATIBILITY SameMajorVersion
) )
# Python bindings # Python bindings. When we're building debs, we use pybuild to directly call
# into setup.py, so none of this applies---debian/rules sets USE_PYTHON=off.
# arch also doesn't use it. fedora does.
if(${USE_PYTHON}) if(${USE_PYTHON})
# when we're building debs, we use pybuild to directly call into setup.py, find_package(Python3 COMPONENTS Development Interpreter REQUIRED)
# so none of this applies. arch also doesn't use it. fedora does. file(GLOB PYSRC CONFIGURE_DEPENDS python/src/notcurses/*.py)
if(NOT "${DFSG_BUILD}") file(COPY python/src/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python/src)
find_package(Python3 COMPONENTS Development Interpreter REQUIRED) file(COPY python/README.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python)
file(GLOB PYSRC CONFIGURE_DEPENDS python/src/notcurses/*.py) set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.py.in")
file(COPY python/src/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python/src) set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py")
file(COPY python/README.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python) set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.cfg.in")
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.py.in") set(SETUP_CFG "${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg")
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py") configure_file(${SETUP_PY_IN} ${SETUP_PY})
set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.cfg.in") configure_file(${SETUP_CFG_IN} ${SETUP_CFG})
set(SETUP_CFG "${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg") add_custom_command(
configure_file(${SETUP_PY_IN} ${SETUP_PY}) OUTPUT
configure_file(${SETUP_CFG_IN} ${SETUP_CFG}) "${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp"
add_custom_command( COMMAND
OUTPUT env LDFLAGS=\"-Wl,-soname,_notcurses.abi3.so.1 -L${CMAKE_CURRENT_BINARY_DIR}\" "${Python3_EXECUTABLE}" ${SETUP_PY} build &&
"${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp" "${Python3_EXECUTABLE}" ${SETUP_PY} egg_info
COMMAND DEPENDS
env LDFLAGS=\"-Wl,-soname,_notcurses.abi3.so.1 -L${CMAKE_CURRENT_BINARY_DIR}\" "${Python3_EXECUTABLE}" ${SETUP_PY} build && ${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses
"${Python3_EXECUTABLE}" ${SETUP_PY} egg_info COMMENT "Building Python wrappers"
DEPENDS WORKING_DIRECTORY
${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses ${CMAKE_CURRENT_BINARY_DIR}/python
COMMENT "Building Python wrappers" )
WORKING_DIRECTORY # build/pytimestamp isn't actually generated, and thus this runs each time.
${CMAKE_CURRENT_BINARY_DIR}/python # python does its own dep tracking, so it "works" out like recursive make.
) add_custom_target(pymod ALL
# build/pytimestamp isn't actually generated, and thus this runs each time. DEPENDS
# python does its own dep tracking, so it "works" out like recursive make. "${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp"
add_custom_target(pymod ALL WORKING_DIRECTORY
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/python
"${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp" )
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}/python
)
install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} setup.py install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python)") install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} setup.py install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python)")
endif()
endif() endif()
# Rust bindings # Rust bindings