Clone of official tools
git_hooks/find_duplicates.py@31:8ea194f6145b, 2017-01-04 (annotated)
- Committer:
- The Other Jimmy
- Date:
- Wed Jan 04 11:58:24 2017 -0600
- Revision:
- 31:8ea194f6145b
Update tools to follow mbed-os tools release 5.3.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
The Other Jimmy |
31:8ea194f6145b | 1 | from os import walk |
The Other Jimmy |
31:8ea194f6145b | 2 | from os.path import join, abspath, dirname, basename, splitext |
The Other Jimmy |
31:8ea194f6145b | 3 | import sys |
The Other Jimmy |
31:8ea194f6145b | 4 | |
The Other Jimmy |
31:8ea194f6145b | 5 | ROOT = abspath(join(dirname(__file__), "..", "..")) |
The Other Jimmy |
31:8ea194f6145b | 6 | sys.path.insert(0, ROOT) |
The Other Jimmy |
31:8ea194f6145b | 7 | |
The Other Jimmy |
31:8ea194f6145b | 8 | from tools.toolchains.gcc import GCC_ARM |
The Other Jimmy |
31:8ea194f6145b | 9 | from tools.targets import TARGET_MAP |
The Other Jimmy |
31:8ea194f6145b | 10 | from argparse import ArgumentParser |
The Other Jimmy |
31:8ea194f6145b | 11 | |
The Other Jimmy |
31:8ea194f6145b | 12 | if __name__ == "__main__": |
The Other Jimmy |
31:8ea194f6145b | 13 | parser = ArgumentParser("Find duplicate file names within a directory structure") |
The Other Jimmy |
31:8ea194f6145b | 14 | parser.add_argument("dirs", help="Directories to search for duplicate file names" |
The Other Jimmy |
31:8ea194f6145b | 15 | , nargs="*") |
The Other Jimmy |
31:8ea194f6145b | 16 | parser.add_argument("--silent", help="Supress printing of filenames, just return number of duplicates", action="store_true") |
The Other Jimmy |
31:8ea194f6145b | 17 | args = parser.parse_args() |
The Other Jimmy |
31:8ea194f6145b | 18 | |
The Other Jimmy |
31:8ea194f6145b | 19 | toolchain = GCC_ARM(TARGET_MAP["K64F"]) |
The Other Jimmy |
31:8ea194f6145b | 20 | |
The Other Jimmy |
31:8ea194f6145b | 21 | resources = sum([toolchain.scan_resources(d) for d in args.dirs], None) |
The Other Jimmy |
31:8ea194f6145b | 22 | |
The Other Jimmy |
31:8ea194f6145b | 23 | scanned_files = {} |
The Other Jimmy |
31:8ea194f6145b | 24 | |
The Other Jimmy |
31:8ea194f6145b | 25 | exit(resources.detect_duplicates(toolchain)) |
The Other Jimmy |
31:8ea194f6145b | 26 |