9 parser = argparse.ArgumentParser()
10 parser.add_argument('patches', metavar='P', type=argparse.FileType('r'), nargs='*',
11 help='list of patches (use - to read patches from stdin)')
12 parser.add_argument('-a', dest='architecture', action='store',
13 help='find developers in charge of this architecture')
14 parser.add_argument('-p', dest='package', action='store',
15 help='find developers in charge of this package')
16 parser.add_argument('-f', dest='files', nargs='*',
17 help='find developers in charge of these files')
18 parser.add_argument('-c', dest='check', action='store_const',
19 const=True, help='list files not handled by any developer')
20 return parser.parse_args()
23 devs = getdeveloperlib.parse_developers()
28 # Check that only one action is given
30 if args.architecture is not None:
32 if args.package is not None:
38 if len(args.patches) != 0:
41 print("Cannot do more than one action")
44 print("No action specified")
47 # Handle the check action
49 files = getdeveloperlib.check_developers(devs)
53 # Handle the architecture action
54 if args.architecture is not None:
56 if args.architecture in dev.architectures:
60 # Handle the package action
61 if args.package is not None:
63 if args.package in dev.packages:
67 # Handle the files action
68 if args.files is not None:
69 args.files = [os.path.abspath(f) for f in args.files]
71 for devfile in dev.files:
72 commonfiles = [f for f in args.files if f.startswith(devfile)]
77 # Handle the patches action
78 if len(args.patches) != 0:
79 (files, infras) = getdeveloperlib.analyze_patches(args.patches)
82 # See if we have developers matching by package name
85 matching_devs.add(dev.name)
86 # See if we have developers matching by package infra
89 matching_devs.add(dev.name)
91 result = "--to buildroot@buildroot.org"
92 for dev in matching_devs:
93 result += " --cc \"%s\"" % dev
96 print("git send-email %s" % result)