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