Skip to content

Commit

Permalink
Ported unused_functions to Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Elvish-Hunter committed Oct 1, 2019
1 parent ffc5edd commit 636f29b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions 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
Expand All @@ -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:]
Expand All @@ -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()

0 comments on commit 636f29b

Please sign in to comment.