#!/usr/bin/env python3 # Usage: see api-review-gen # Copyright (C) 2023 The Qt Company Ltd. # SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only """Combine 'mod ...' lines with common values of mod, saving duplication in ... It was too complicated to put inside a python3 -c '...' string without either the shell or python getting upset about nesting of quotes of different types. """ import sys; mods = {} for line in sys.stdin: mod, cmake = line.split(" ", 1) mods.setdefault(mod, set()).add(cmake.strip()) print("\n".join(f"{mod} {' '.join(seq)}" for mod, seq in mods.items()))