Development mbed library for MAX32630FTHR
Dependents: blinky_max32630fthr
tools/git_hooks/find_duplicates.py@0:5c4d7b2438d3, 2016-11-11 (annotated)
- Committer:
- switches
- Date:
- Fri Nov 11 20:59:50 2016 +0000
- Revision:
- 0:5c4d7b2438d3
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
switches | 0:5c4d7b2438d3 | 1 | from os import walk |
switches | 0:5c4d7b2438d3 | 2 | from os.path import join, abspath, dirname, basename, splitext |
switches | 0:5c4d7b2438d3 | 3 | import sys |
switches | 0:5c4d7b2438d3 | 4 | |
switches | 0:5c4d7b2438d3 | 5 | ROOT = abspath(join(dirname(__file__), "..", "..")) |
switches | 0:5c4d7b2438d3 | 6 | sys.path.insert(0, ROOT) |
switches | 0:5c4d7b2438d3 | 7 | |
switches | 0:5c4d7b2438d3 | 8 | from tools.toolchains.gcc import GCC_ARM |
switches | 0:5c4d7b2438d3 | 9 | from tools.targets import TARGET_MAP |
switches | 0:5c4d7b2438d3 | 10 | from argparse import ArgumentParser |
switches | 0:5c4d7b2438d3 | 11 | |
switches | 0:5c4d7b2438d3 | 12 | if __name__ == "__main__": |
switches | 0:5c4d7b2438d3 | 13 | parser = ArgumentParser("Find duplicate file names within a directory structure") |
switches | 0:5c4d7b2438d3 | 14 | parser.add_argument("dirs", help="Directories to search for duplicate file names" |
switches | 0:5c4d7b2438d3 | 15 | , nargs="*") |
switches | 0:5c4d7b2438d3 | 16 | parser.add_argument("--silent", help="Supress printing of filenames, just return number of duplicates", action="store_true") |
switches | 0:5c4d7b2438d3 | 17 | args = parser.parse_args() |
switches | 0:5c4d7b2438d3 | 18 | |
switches | 0:5c4d7b2438d3 | 19 | toolchain = GCC_ARM(TARGET_MAP["K64F"]) |
switches | 0:5c4d7b2438d3 | 20 | |
switches | 0:5c4d7b2438d3 | 21 | resources = sum([toolchain.scan_resources(d) for d in args.dirs], None) |
switches | 0:5c4d7b2438d3 | 22 | |
switches | 0:5c4d7b2438d3 | 23 | scanned_files = {} |
switches | 0:5c4d7b2438d3 | 24 | |
switches | 0:5c4d7b2438d3 | 25 | exit(resources.detect_duplicates(toolchain)) |
switches | 0:5c4d7b2438d3 | 26 |