build: make Python3 mandatory

Type: refactor
Change-Id: Iac27ac4d11745b68c57a0394ced51942db8f0431
Signed-off-by: Damjan Marion <dmarion@0xa5.net>
This commit is contained in:
Damjan Marion
2023-03-06 18:29:26 +00:00
committed by Dave Wallace
parent 3ffc77da2b
commit 1cada9ad78

View File

@ -11,27 +11,21 @@
# See the License for the specific language governing permissions and
# limitations under the License.
if (CMAKE_VERSION VERSION_LESS 3.12)
find_package(PythonInterp 2.7)
else()
find_package(Python3 COMPONENTS Interpreter)
set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND})
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
endif()
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set(PYTHONINTERP_FOUND ${Python3_Interpreter_FOUND})
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
if(PYTHONINTERP_FOUND)
install(
CODE "
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${PYTHON_EXECUTABLE} ./setup.py
install
--root=\$ENV{DESTDIR}/
--prefix=${CMAKE_INSTALL_PREFIX}
--single-version-externally-managed
bdist_egg
OUTPUT_QUIET
)"
COMPONENT vpp-api-python
)
endif()
install(
CODE "
execute_process(
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${PYTHON_EXECUTABLE} ./setup.py
install
--root=\$ENV{DESTDIR}/
--prefix=${CMAKE_INSTALL_PREFIX}
--single-version-externally-managed
bdist_egg
OUTPUT_QUIET
)"
COMPONENT vpp-api-python
)