File indexing completed on 2024-05-12 15:49:58
0001 #!/usr/bin/env python 0002 0003 # SPDX-FileCopyrightText: 2016 Kevin Funk <kfunk@kde.org> 0004 # 0005 # SPDX-License-Identifier: LGPL-2.0-or-later 0006 0007 # This script will print XML-like code you can put into the qmake.xml 0008 # syntax definition file 0009 # 0010 # Prerequisite: You need to have a qtbase checkout somewhere 0011 # 0012 # Usage: qmake-gen.py /path/to/qtbase/ 0013 0014 from __future__ import print_function 0015 0016 import subprocess 0017 import os 0018 import sys 0019 0020 qt5Source = sys.argv[1] 0021 0022 qmakeKeywords = subprocess.check_output("ag --nofilename 'QMAKE_[A-Z_0-9]+' {0}/mkspecs -o".format(qt5Source), shell=True).split(os.linesep) 0023 extraKeywords = subprocess.check_output("sed -nr 's/\\\section1 ([A-Z_0-9]{{2,100}}).*/\\1/p' {0}/qmake/doc/src/qmake-manual.qdoc".format(qt5Source), shell=True).split(os.linesep) 0024 keywords = [] 0025 keywords = [x.strip() for x in qmakeKeywords] 0026 keywords += [x.strip() for x in extraKeywords] 0027 keywords = list(set(keywords)) # remove duplicates 0028 keywords.sort() 0029 0030 functions = subprocess.check_output("sed -nr 's/\{{ \\\"(.+)\\\", T_.+/\\1/p' {0}/qmake/library/qmakebuiltins.cpp".format(qt5Source), shell=True).split(os.linesep) 0031 functions.sort() 0032 0033 def printItems(container): 0034 for item in container: 0035 trimmedText = item.strip() 0036 if not trimmedText: 0037 continue 0038 0039 print("<item> %s </item>" % trimmedText) 0040 print() 0041 0042 print("KEYWORDS") 0043 printItems(keywords) 0044 0045 print("FUNCTIONS") 0046 printItems(functions)