Resolves: tdf#149408 inspector crash with a writer OLE inside calc
[LibreOffice.git] / bin / find-files-not-referenced-by-makefile.py
blob70232ed1c459ae28fa105f06c657447dca6d4b72
1 #!/usr/bin/python2
3 # Look for CXX files that are not referenced by any makefile
5 import subprocess
6 import sys
8 sourceFiles = set()
10 a = subprocess.Popen("git ls-files", stdout=subprocess.PIPE, shell=True)
11 with a.stdout as txt:
12 for filename in txt:
13 if filename.find(".cxx") != -1 \
14 and filename.find("precompiled") == -1 \
15 and filename.find("/workben") == -1 \
16 and not filename.startswith("odk/examples/") \
17 and not filename.startswith("bridges/") \
18 and not filename.startswith("compilerplugins/") \
19 and filename.find("/qa/") == -1 \
20 and filename.find("/test/") == -1 \
21 and not filename.startswith("testtools/") \
22 and not filename.startswith("vcl/") \
23 and not filename.startswith("cli_ure/"):
24 sourceFiles.add(filename.strip())
26 a = subprocess.Popen("git ls-files */*.mk", stdout=subprocess.PIPE, shell=True)
27 with a.stdout as txt:
28 for makefilename in txt:
29 makefilename = makefilename.strip()
30 with open(makefilename, "r") as makefile:
31 moduleName = makefilename[:makefilename.find("/")]
32 state = 0
33 for line in makefile:
34 line = line.strip()
35 if state == 0 and "_add_exception_objects" in line:
36 state = 1
37 elif state == 1 and line != "))":
38 s = line.replace("\\","").replace(")", "").strip()
39 # parse line like: $(call gb_Helper_optional,AVMEDIA,svx/source/sidebar/media/MediaPlaybackPanel) \
40 idx = s.rfind(",")
41 if idx != -1:
42 s = s[idx+1:].strip()
43 sourceFiles.discard(s + ".cxx")
44 elif state == 1:
45 state = 0
50 print "files not listed in makefile"
51 print "----------------------------"
52 for x in sorted(sourceFiles):
53 print x