From 9c85078dc2bc8e728e9c0c6c797d29491da5d2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A5rten=20Nordheim?= Date: Thu, 30 Apr 2020 13:34:24 +0200 Subject: Support special casing in configure.cmake Change-Id: Ib899a5446a81e2604ba3642b9ad37aedc18ca650 Reviewed-by: Alexandru Croitor --- util/cmake/configurejson2cmake.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'util/cmake/configurejson2cmake.py') diff --git a/util/cmake/configurejson2cmake.py b/util/cmake/configurejson2cmake.py index d85cd7e4f2..f1bbcaca3e 100755 --- a/util/cmake/configurejson2cmake.py +++ b/util/cmake/configurejson2cmake.py @@ -33,7 +33,9 @@ import re import sys from typing import Optional, Set from textwrap import dedent +import os +from special_case_helper import SpecialCaseHandler from helper import ( map_qt_library, featureName, @@ -1359,7 +1361,9 @@ def processJson(path, ctx, data): ctx = processFiles(ctx, data) - with open(posixpath.join(path, "configure.cmake"), "w") as cm_fh: + destination = posixpath.join(path, "configure.cmake") + generated_file = destination + '.gen' + with open(generated_file, "w") as cm_fh: cm_fh.write("\n\n#### Inputs\n\n") processInputs(ctx, data, cm_fh) @@ -1389,6 +1393,16 @@ def processJson(path, ctx, data): # do this late: processSubconfigs(path, ctx, data) + handler = SpecialCaseHandler( + os.path.abspath(destination), + os.path.abspath(generated_file), + os.path.abspath(path), + convertingProFiles=False, + debug=False, + ) + if handler.handle_special_cases(): + os.replace(generated_file, destination) + def main(): if len(sys.argv) != 2: -- cgit v1.2.3