Rtos API example

Committer:
marcozecchini
Date:
Sat Feb 23 12:13:36 2019 +0000
Revision:
0:9fca2b23d0ba
final commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
marcozecchini 0:9fca2b23d0ba 1 from os import walk
marcozecchini 0:9fca2b23d0ba 2 from os.path import join, abspath, dirname, basename, splitext
marcozecchini 0:9fca2b23d0ba 3 import sys
marcozecchini 0:9fca2b23d0ba 4
marcozecchini 0:9fca2b23d0ba 5 ROOT = abspath(join(dirname(__file__), "..", ".."))
marcozecchini 0:9fca2b23d0ba 6 sys.path.insert(0, ROOT)
marcozecchini 0:9fca2b23d0ba 7
marcozecchini 0:9fca2b23d0ba 8 from tools.toolchains.gcc import GCC_ARM
marcozecchini 0:9fca2b23d0ba 9 from tools.targets import TARGET_MAP
marcozecchini 0:9fca2b23d0ba 10 from argparse import ArgumentParser
marcozecchini 0:9fca2b23d0ba 11
marcozecchini 0:9fca2b23d0ba 12 if __name__ == "__main__":
marcozecchini 0:9fca2b23d0ba 13 parser = ArgumentParser("Find duplicate file names within a directory structure")
marcozecchini 0:9fca2b23d0ba 14 parser.add_argument("dirs", help="Directories to search for duplicate file names"
marcozecchini 0:9fca2b23d0ba 15 , nargs="*")
marcozecchini 0:9fca2b23d0ba 16 parser.add_argument("--silent", help="Supress printing of filenames, just return number of duplicates", action="store_true")
marcozecchini 0:9fca2b23d0ba 17 args = parser.parse_args()
marcozecchini 0:9fca2b23d0ba 18
marcozecchini 0:9fca2b23d0ba 19 toolchain = GCC_ARM(TARGET_MAP["K64F"])
marcozecchini 0:9fca2b23d0ba 20
marcozecchini 0:9fca2b23d0ba 21 resources = sum([toolchain.scan_resources(d) for d in args.dirs], None)
marcozecchini 0:9fca2b23d0ba 22
marcozecchini 0:9fca2b23d0ba 23 scanned_files = {}
marcozecchini 0:9fca2b23d0ba 24
marcozecchini 0:9fca2b23d0ba 25 exit(resources.detect_duplicates(toolchain))
marcozecchini 0:9fca2b23d0ba 26