blob: 0302fc2f87c51dc5513faee3289f9e61a19510c9 (
plain)
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
|
#!/usr/bin/env python3
import sys
import json
objects = json.load(sys.stdin)
for i in range(len(objects) - 1, -1, -1):
obj = objects[i]
# Remove everything except .c files
if not obj["file"].endswith(".c"):
objects.remove(obj)
continue
# remove duplicates introduced my multiarch
if "CLIB_MARCH_VARIANT" in obj["command"]:
objects.remove(obj)
continue
# remove if there is no command
if obj["command"] == "":
objects.remove(obj)
continue
# remove ccache prefix
s = str.split(obj["command"])
if s[0] == "ccache":
s.remove(s[0])
s[0] = s[0].split("/")[-1]
obj["command"] = " ".join(s)
json.dump(objects, sys.stdout, indent=2)
|