From 636f29b0b96bc9dae3637a7e6d259a9e4b788fa1 Mon Sep 17 00:00:00 2001 From: Elvish_Hunter Date: Tue, 1 Oct 2019 11:37:26 +0200 Subject: [PATCH] Ported unused_functions to Python 3 --- changelog.md | 2 +- utils/unused_functions.py | 22 ++++++++++------------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/changelog.md b/changelog.md index 1ded4d88b856..bc6abd2fa730 100644 --- a/changelog.md +++ b/changelog.md @@ -55,7 +55,7 @@ ### Miscellaneous and bug fixes * Fixed :droid's arguments not all being optional (Issue#4308) * Ported the "expand-terrain-macros", "wmlflip", "wmlparser", "umc-dev/build/update_version", - "wiki_grabber" and "ai_test" tools to Python 3 + "wiki_grabber", "ai_test" and "unused_functions" tools to Python 3 * It's now possible to chat with oneself in SP campaigns. Chat is shown in replays. (Issue#1111) * Removed unused "scoutDefault", "journeylifter", "wescamp_import" and "wmlvalidator" Python tools * Fixed wmlscope not correctly performing expansion of square braces in filenames in some conditions diff --git a/utils/unused_functions.py b/utils/unused_functions.py index 13ac06b5a2e4..64ba08d13769 100755 --- a/utils/unused_functions.py +++ b/utils/unused_functions.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 """ This script is used to detect functions in the source code which are no longer @@ -19,16 +19,13 @@ def nm(filename): return os.popen("nm -C %s" % filename).read() output1 = [] -for o in glob.glob("src/*.o") + glob.glob("src/*/*.o") + \ - glob.glob("src/*/*/*.o") + glob.glob("src/*/*/*/*.o"): +for o in glob.glob("build/release/*.o") + glob.glob("build/release/*/*.o") + \ + glob.glob("build/release/*/*/*.o") + glob.glob("build/release/*/*/*/*.o"): output1.append((o, nm(o))) -output2 = nm("src/wesnoth") -output2 += nm("src/campaignd") -output2 += nm("src/exploder") -output2 += nm("src/cutter") -output2 += nm("src/wesnothd") -output2 += nm("src/test") +output2 = nm("wesnoth") +output2 += nm("campaignd") +output2 += nm("wesnothd") def extract(line): return line[line.find(" T ") + 3:] @@ -47,6 +44,7 @@ def symbols(lines): found += [symbol] if found: - print "%s:" % o[0] - print "\n".join(found) - print + print("%s:" % o[0]) + print("\n".join(found)) + print() +