build: complete python3 support, no hardcode path 36/33736/4
authorNick Brown <nickbroon@gmail.com>
Thu, 16 Sep 2021 09:56:33 +0000 (10:56 +0100)
committerOle Tr�an <otroan@employees.org>
Tue, 28 Sep 2021 11:11:55 +0000 (11:11 +0000)
find_package(Python3) will not set variables that are later used, so set
those needed. Perhaps the python2 support, which is EOL, could be
dropped?

Use DESTDIR, instead of hardcoding the path. This allows system
packaging, or local installs, to work properly.

Type: make
Signed-off-by: Nick Brown <nickbroon@gmail.com>
Change-Id: I045516c61473c612ab70858cd9b58c4e2838b347

src/vpp-api/python/CMakeLists.txt

index 6450fd9..789a722 100644 (file)
@@ -15,6 +15,8 @@ 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()
 
 if(PYTHONINTERP_FOUND)
@@ -24,11 +26,10 @@ if(PYTHONINTERP_FOUND)
       WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
       COMMAND ${PYTHON_EXECUTABLE} ./setup.py
        install
-         --root /
+         --root=\$ENV{DESTDIR}/
          --prefix=${CMAKE_INSTALL_PREFIX}
          --single-version-externally-managed
          bdist_egg
-         --dist-dir=${CMAKE_INSTALL_PREFIX}
       OUTPUT_QUIET
     )"
     COMPONENT vpp-api-python