Skip to content

Commit 997d30b

Browse files
committed
Revert "DISPATCH-1942 Use findPython when on CMake3.15+"
This reverts commit f486435
1 parent 1a62649 commit 997d30b

File tree

6 files changed

+20
-77
lines changed

6 files changed

+20
-77
lines changed

CMakeLists.txt

+12-16
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,8 @@ else (NOT APPLE)
6262
set(rt "")
6363
endif (NOT APPLE)
6464

65-
# This setting mirrors FindPythonInterp behavior on Windows/macOS, which did not consult registry/frameworks first.
66-
if (NOT DEFINED Python_FIND_REGISTRY)
67-
set(Python_FIND_REGISTRY "LAST")
68-
endif ()
69-
if (NOT DEFINED Python_FIND_FRAMEWORK)
70-
set(Python_FIND_FRAMEWORK "LAST")
71-
endif ()
72-
find_package(Python REQUIRED COMPONENTS Interpreter Development)
65+
find_package(PythonInterp REQUIRED)
66+
find_package(PythonLibs REQUIRED)
7367
find_package(Threads REQUIRED)
7468
find_package(Proton 0.33.0 REQUIRED COMPONENTS Core Proactor)
7569
message(STATUS "Found Proton: ${Proton_LIBRARIES} (found version \"${Proton_VERSION}\")" )
@@ -108,29 +102,31 @@ if (LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
108102
endif(LIBWEBSOCKETS_FOUND AND LIBWEBSOCKETS_VERSION_STRING)
109103

110104
# Python
111-
if (Python_VERSION_MAJOR STREQUAL 3)
105+
if (PYTHON_VERSION_MAJOR STREQUAL 3)
112106
set(PY_STRING "python3")
113-
elseif(Python_VERSION_MAJOR STREQUAL 2)
107+
elseif(PYTHON_VERSION_MAJOR STREQUAL 2)
114108
set(PY_STRING "python")
115109
endif()
116110

111+
enable_testing()
112+
117113
# python unittest
118114
# For versions < 2.7 the developer needs to install the unittest2
119115
# module (available via 'yum install python-unittest2' or 'pip install unittest2'
120116
#
121-
if(Python_VERSION_MAJOR EQUAL 2 AND Python_VERSION_MINOR LESS 7)
117+
if(PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR LESS 7)
122118
set(PYTHON_TEST_COMMAND "unit2")
123-
execute_process(COMMAND "${Python_EXECUTABLE}" "-c" "import unittest2"
119+
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import unittest2"
124120
RESULT_VARIABLE UNITTEST_MISSING
125121
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
126122
if(UNITTEST_MISSING)
127123
message(WARNING "python-unittest2 is not installed. ***unit tests cannot be run***\ntry 'pip install python-unittest2' to install python-unittest2")
128124
# add bogus test for folk who may have missed the cmake warning
129125
add_test(WARNING_python_unittest2_module_NOT_INSTALLED false)
130126
endif(UNITTEST_MISSING)
131-
else(Python_VERSION_MAJOR EQUAL 2 AND Python_VERSION_MINOR LESS 7)
127+
else(PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR LESS 7)
132128
set(PYTHON_TEST_COMMAND "-m" "unittest")
133-
endif(Python_VERSION_MAJOR EQUAL 2 AND Python_VERSION_MINOR LESS 7)
129+
endif(PYTHON_VERSION_MAJOR EQUAL 2 AND PYTHON_VERSION_MINOR LESS 7)
134130

135131
if(NOT UNITTEST_MISSING)
136132
if (NOT DEFINED DISPATCH_TEST_TIMEOUT)
@@ -166,7 +162,7 @@ set(CONSOLE_BASE_INSTALL_DIR "share/qpid-dispatch/console")
166162
set(CONSOLE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CONSOLE_BASE_INSTALL_DIR}")
167163
set(CONSOLE_STAND_ALONE_INSTALL_DIR "${CONSOLE_INSTALL_DIR}")
168164

169-
set(RUN ${Python_EXECUTABLE} ${CMAKE_BINARY_DIR}/run.py)
165+
set(RUN ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/run.py)
170166

171167
# define the configuration directory based on whether or not the install prefix is defined
172168
if(NOT DEFINED SYSCONF_INSTALL_DIR)
@@ -197,7 +193,7 @@ include_directories(
197193
${CMAKE_CURRENT_BINARY_DIR}/include
198194
${Proton_Proactor_INCLUDE_DIRS}
199195
${Proton_Core_INCLUDE_DIRS}
200-
${Python_INCLUDE_DIRS}
196+
${PYTHON_INCLUDE_PATH}
201197
)
202198

203199
# Originally from the LLVM project, https://opensource.apple.com/source/llvmCore/llvmCore-2358.3/CMakeLists.txt.auto.html

cmake/FindPython.cmake

-57
This file was deleted.

python/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/qpid_dispatch_site.py.in
2727
${CMAKE_CURRENT_BINARY_DIR}/qpid_dispatch_site.py)
2828

2929
# Install script for public python modules
30-
install(CODE "execute_process(COMMAND ${Python_EXECUTABLE} setup.py -v install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
30+
install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} setup.py -v install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})")
3131

3232
install(FILES
3333
${CMAKE_CURRENT_SOURCE_DIR}/qpid_dispatch/management/qdrouter.json

python/install_python.cmake

+4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@
2020
# Install script to install public python modules.
2121
# Install with setup.py, add installed files to install manifest.
2222

23+
include(FindPythonInterp)
24+
2325
set(PYTHON_MANIFEST ${CMAKE_BINARY_DIR}/python_manifest.txt)
2426

27+
28+
2529
file(READ ${PYTHON_MANIFEST} PYTHON_MANIFEST_FILES)
2630
list(APPEND CMAKE_INSTALL_MANIFEST_FILES ${PYTHON_MANIFEST_FILES})

src/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ set(GENERATOR_DEPENDS ${GENERATOR_DEPENDS} ${GENERATOR_SRC})
3333

3434
add_custom_command (
3535
OUTPUT ${GENERATED_SOURCES}
36-
COMMAND ${Python_EXECUTABLE} ${CMAKE_BINARY_DIR}/tests/run.py -s ${CMAKE_CURRENT_SOURCE_DIR}/schema_c.py
36+
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/tests/run.py -s ${CMAKE_CURRENT_SOURCE_DIR}/schema_c.py
3737
DEPENDS ${GENERATOR_DEPENDS})
3838

3939
# Build the qpid-dispatch library.
@@ -134,7 +134,7 @@ set(qpid_dispatch_LIBRARIES
134134
${CMAKE_THREAD_LIBS_INIT}
135135
${rt_lib}
136136
${CMAKE_DL_LIBS}
137-
${Python_LIBRARIES}
137+
${PYTHON_LIBRARIES}
138138
)
139139

140140
# USE_LIBWEBSOCKETS is true only if LIBWEBSOCKETS_FOUND

tests/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ if(USE_BWRAP)
7171
else()
7272
set(BWRAP_ARGS "")
7373
endif()
74-
set(TEST_WRAP ${BWRAP_ARGS} ${Python_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/run.py)
74+
set(TEST_WRAP ${BWRAP_ARGS} ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/run.py)
7575

7676
add_test(unit_tests_size_10000 ${TEST_WRAP} unit_tests_size 10000)
7777
add_test(unit_tests_size_512 ${TEST_WRAP} unit_tests_size 512)

0 commit comments

Comments
 (0)