10 parser = argparse.ArgumentParser()
11 parser.add_argument('patches', metavar='P', type=argparse.FileType('r'), nargs='*',
12 help='list of patches (use - to read patches from stdin)')
13 parser.add_argument('-a', dest='architecture', action='store',
14 help='find developers in charge of this architecture')
15 parser.add_argument('-p', dest='package', action='store',
16 help='find developers in charge of this package')
17 parser.add_argument('-f', dest='files', nargs='*',
18 help='find developers in charge of these files')
19 parser.add_argument('-c', dest='check', action='store_const',
20 const=True, help='list files not handled by any developer')
21 return parser.parse_args()
25 devs = getdeveloperlib.parse_developers()
30 # Check that only one action is given
32 if args.architecture is not None:
34 if args.package is not None:
40 if len(args.patches) != 0:
43 print("Cannot do more than one action")
46 print("No action specified")
49 # Handle the check action
51 files = getdeveloperlib.check_developers(devs)
55 # Handle the architecture action
56 if args.architecture is not None:
58 if args.architecture in dev.architectures:
62 # Handle the package action
63 if args.package is not None:
65 if args.package in dev.packages:
69 # Handle the files action
70 if args.files is not None:
71 args.files = [os.path.abspath(f) for f in args.files]
73 for devfile in dev.files:
74 commonfiles = [f for f in args.files if f.startswith(devfile)]
79 # Handle the patches action
80 if len(args.patches) != 0:
81 (files, infras) = getdeveloperlib.analyze_patches(args.patches)
84 # See if we have developers matching by package name
87 matching_devs.add(dev.name)
88 # See if we have developers matching by package infra
91 matching_devs.add(dev.name)
93 result = "--to buildroot@buildroot.org"
94 for dev in matching_devs:
95 result += " --cc \"%s\"" % dev
98 print("git send-email %s" % result)