From: Wolfgang Bangerth Date: Fri, 23 May 2025 15:25:24 +0000 (-0600) Subject: Add the script that creates the primary module interface unit. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b92af3b22310361c32bd5232c90a70db243910b2;p=dealii.git Add the script that creates the primary module interface unit. --- diff --git a/contrib/utilities/build_primary_interface_unit.py b/contrib/utilities/build_primary_interface_unit.py new file mode 100644 index 0000000000..1f4b96159c --- /dev/null +++ b/contrib/utilities/build_primary_interface_unit.py @@ -0,0 +1,50 @@ +#!/usr/bin/python3 + +## ------------------------------------------------------------------------ +## +## SPDX-License-Identifier: LGPL-2.1-or-later +## Copyright (C) 2014 - 2022 by the deal.II authors +## +## This file is part of the deal.II library. +## +## Part of the source code is dual licensed under Apache-2.0 WITH +## LLVM-exception OR LGPL-2.1-or-later. Detailed license information +## governing the source code and code contributions can be found in +## LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II. +## +## ------------------------------------------------------------------------ + +# Given a list of interface module units that each contain an exported +# module partition, create a primary module interface unit that +# creates the 'dealii' module. +# +# Call this script via +# python3 contrib/utilities/convert_header_file_to_interface_module_unit.py +# The program outputs the primary module interface unit to the console. + + +import sys +import re + + +match_export = re.compile(r"^export module dealii *: *(.*);") + + +# Print the header of the primary module partition: +print("module;") +print("export module dealii;") + +# Go through all input files and check their exported module partitions: +for module_input_file in sys.argv[1:] : + input = open(module_input_file, "r") + + # Read through the lines of the file and see where it exports a + # module partition. Then 'export import' that partition: + for line in input : + m = match_export.match(line) + if m : + print("export import :" + m.group(1) + ";") + + # A file can only contain a single interface module + # partition. So once we found one, we can stop parsing. + break;