OSDN Git Service

add script to find all QT_HAVE_* definitions
authorIvailo Monev <xakepa10@gmail.com>
Mon, 28 Dec 2020 07:11:44 +0000 (09:11 +0200)
committerIvailo Monev <xakepa10@gmail.com>
Mon, 28 Dec 2020 07:11:44 +0000 (09:11 +0200)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
scripts/gethave.py [new file with mode: 0755]

diff --git a/scripts/gethave.py b/scripts/gethave.py
new file mode 100755 (executable)
index 0000000..e50a287
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/python
+
+import os, re
+
+cwd = os.path.dirname(__file__)
+regex = re.compile('(QT_HAVE_[\w]+)')
+lmatches = []
+
+for root, subdirs, files in os.walk('%s/../src' % cwd):
+    for sfile in files:
+        if sfile.endswith(('.cpp', '.h')):
+            sfull = '%s/%s' % (root, sfile)
+            with open(sfull, 'rb') as f:
+                scontent = f.read()
+            scontent = scontent.decode('utf-8')
+            for smatch in regex.findall(scontent):
+                smatch = smatch.strip('"\'')
+                if not smatch in lmatches:
+                    lmatches.append(smatch)
+
+print('\n'.join(sorted(lmatches)))