Skip to content

Commit b9eab5e

Browse files
stweilstsquad
authored andcommitted
scripts/nsis.py: Run dependency check for each DLL file only once
Each DLL should only be checked once for dependencies, but several hundred (781 in my test) unneeded checks were done. Now the script is significantly faster (16 s in my build). Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-Id: <20250111215244.1680931-1-sw@weilnetz.de> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20250116160306.1709518-38-alex.bennee@linaro.org>
1 parent a4340e7 commit b9eab5e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

scripts/nsis.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ def find_deps(exe_or_dll, search_path, analyzed_deps):
3737

3838
analyzed_deps.add(dep)
3939
# locate the dll dependencies recursively
40-
rdeps = find_deps(dll, search_path, analyzed_deps)
40+
analyzed_deps, rdeps = find_deps(dll, search_path, analyzed_deps)
4141
deps.extend(rdeps)
4242

43-
return deps
43+
return analyzed_deps, deps
4444

4545
def main():
4646
parser = argparse.ArgumentParser(description="QEMU NSIS build helper.")
@@ -92,18 +92,18 @@ def main():
9292
dlldir = os.path.join(destdir + prefix, "dll")
9393
os.mkdir(dlldir)
9494

95+
analyzed_deps = set()
9596
for exe in glob.glob(os.path.join(destdir + prefix, "*.exe")):
9697
signcode(exe)
9798

9899
# find all dll dependencies
99-
deps = set(find_deps(exe, search_path, set()))
100+
analyzed_deps, deps = find_deps(exe, search_path, analyzed_deps)
101+
deps = set(deps)
100102
deps.remove(exe)
101103

102104
# copy all dlls to the DLLDIR
103105
for dep in deps:
104106
dllfile = os.path.join(dlldir, os.path.basename(dep))
105-
if (os.path.exists(dllfile)):
106-
continue
107107
print("Copying '%s' to '%s'" % (dep, dllfile))
108108
shutil.copy(dep, dllfile)
109109

0 commit comments

Comments
 (0)