build: check for presence of python ply 84/38284/3
authorDamjan Marion <dmarion@me.com>
Wed, 15 Feb 2023 21:10:05 +0000 (22:10 +0100)
committerDave Wallace <dwallacelf@gmail.com>
Tue, 7 Mar 2023 02:29:56 +0000 (02:29 +0000)
Type: improvement
Change-Id: I4f190607bfce404fbe68ec968e6923509ea9519b
Signed-off-by: Damjan Marion <dmarion@me.com>
src/tools/vppapigen/CMakeLists.txt

index bfabc3a..04ebed5 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+find_package(
+  Python3
+  REQUIRED
+  COMPONENTS Interpreter
+)
+
+execute_process(
+  COMMAND ${Python3_EXECUTABLE} -c "import ply"
+  RESULT_VARIABLE _rv
+  OUTPUT_QUIET
+)
+
+if (NOT ${_rv} EQUAL 0)
+  message( FATAL_ERROR "The \"ply\" Python3 package is not installed.")
+endif()
+
 install(
   FILES vppapigen.py
   RENAME vppapigen