From 218ebf0faef5d5034cae74a700f293a04948b779 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Thu, 29 Feb 2024 13:13:33 -0500 Subject: [PATCH] tooling: Windows: propagate failure from the CMakeLists.txt Also don't install pywinmake from the CMakeLists.txt. Change-Id: Idf77fa95e1166561c809fba50b867a07d3358a83 --- CMakeLists.txt | 10 ++++++++-- extras/scripts/winmake.py | 7 ++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index abdcfe164d..3c1bbe7c28 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,10 +116,16 @@ if (BUILD_CONTRIB) WORKING_DIRECTORY ${CONTRIB_BUILD_PATH}) else() set(SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/extras/scripts) - execute_process(COMMAND python -m pip install ${SCRIPTS_DIR}/pywinmake) execute_process( COMMAND python ${SCRIPTS_DIR}/winmake.py - WORKING_DIRECTORY ${SCRIPTS_DIR}) + WORKING_DIRECTORY ${SCRIPTS_DIR} + RESULT_VARIABLE BUILD_RESULT + ) + if (BUILD_RESULT) + message(FATAL_ERROR "Contrib build failed.") + else() + message(STATUS "Contrib build successful.") + endif() endif() endif() diff --git a/extras/scripts/winmake.py b/extras/scripts/winmake.py index aad43a81db..aa0e7f8f67 100644 --- a/extras/scripts/winmake.py +++ b/extras/scripts/winmake.py @@ -11,6 +11,7 @@ import os import time from datetime import timedelta import argparse +import sys from pywinmake.utils import log, logger, sh_exec from pywinmake.package import Versioner, Paths, Operation, Package @@ -77,7 +78,11 @@ def build_from_dir(path, out_dir=None): # Build the package at the given path. out_dir = os.path.join(path, "build") if out_dir is None else out_dir pkg = Package(src_dir=path, buildsrc_dir=out_dir) - builder.build(pkg) + if builder.build(pkg): + log.info(f"Package {pkg.name} built successfully.") + else: + log.error(f"Package {pkg.name} failed to build.") + sys.exit(1) def main(): start_time = time.time() -- GitLab