File: FilterLCovData.py

package info (click to toggle)
swift-im 5.0~alpha2.145.g12d031cf8%2Bdfsg-4.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,256 kB
  • sloc: cpp: 134,640; python: 2,701; sh: 774; xml: 561; javascript: 69; makefile: 59
file content (31 lines) | stat: -rwxr-xr-x 887 bytes parent folder | download
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
#!/usr/bin/env python

# TODO: Add uncovered non-ignored files

import sys, re, os.path

assert(len(sys.argv) == 2)

def isIgnored(file) :
    return (file.find("/Swiften/") == -1 and file.find("/Slimber/") == -1 and file.find("/Swift/") == -1) or (file.find("/UnitTest/") != -1 or file.find("/QA/") != -1)

output = []
inputFile = open(sys.argv[1])
inIgnoredFile = False
for line in inputFile.readlines() :
    if inIgnoredFile :
        if line == "end_of_record\n" :
            inIgnoredFile = False
    else :
        if line.startswith("SF:") and isIgnored(line) :
            inIgnoredFile = True
        else :
            m = re.match("SF:(.*)", line)
            if m :
                line = "SF:" + os.path.realpath(m.group(1)) + "\n"
            output.append(line)
inputFile.close()

outputFile = open(sys.argv[1], 'w')
outputFile.write(''.join(output))
outputFile.close()