forked from S2E/qemu
-
Notifications
You must be signed in to change notification settings - Fork 1
/
make_qt_project.py
executable file
·74 lines (59 loc) · 1.55 KB
/
make_qt_project.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/usr/bin/python
from subprocess import Popen, PIPE
import sys
import os
whitelist = [
'qemu/target/i386'
]
blacklist = [
# The following files are for non-x86 targets
# they cause false positives when looking up symbols
'qemu/target',
'qemu/darwin-user/',
'qemu/bsd-user/',
'qemu/pc-bios/',
'qemu/roms/',
'qemu/tests/',
'qemu/tcg/arm/',
'qemu/tcg/hppa/',
'qemu/tcg/i386/',
'qemu/tcg/mips/',
'qemu/tcg/ppc/',
'qemu/tcg/ppc64/',
'qemu/tcg/s390/',
'qemu/tcg/sparc/',
]
def is_blacklisted(fname):
for w in whitelist:
if fname.startswith(w):
return False
for b in blacklist:
if fname.startswith(b):
return True
return False
if os.path.isdir('.git'):
git_files = Popen(['git', 'ls-files'],
stdout=PIPE).communicate()[0].split('\n')
else:
sys.stderr.write('This is not a git repository!\n')
sys.exit(1)
git_files.sort()
dirs = set([""])
qemu_files = open('qemu.files', 'w')
qemu_includes = open('qemu.includes', 'w')
for fname in git_files:
if is_blacklisted(fname):
break
if not os.path.isdir(fname):
qemu_files.write(fname + '\n')
fdir = fname
while fdir != "":
fdir = os.path.dirname(fdir)
if fdir not in dirs and os.path.isdir(fdir):
qemu_includes.write(fdir + '\n')
dirs.add(fdir)
qemu_includes.write('\n'.join([]))
qemu_files.close()
qemu_includes.close()
with open('qemu.creator', 'w') as fp:
print >>fp, "[General]"