@classmethod<EOL><INDENT>def from_args(cls, args=None, skip_dir_check=False):<DEDENT>
parser = argparse.ArgumentParser()<EOL>parser.set_defaults(target='<STR_LIT>', build='<STR_LIT>', tests=None)  <EOL>target_group = parser.add_argument_group('<STR_LIT>')<EOL>target_group.add_argument('<STR_LIT>', choices=sorted(cls.TARGET_CHOICES),<EOL>help=('<STR_LIT>'))<EOL>target_group.add_argument('<STR_LIT>', choices=sorted(Platform.SUPPORTED),<EOL>help=('<STR_LIT>' + std_platform.system() + '<STR_LIT:)>'))<EOL>cpu_choices = sorted(set(itertools.chain(itertools.chain.from_iterable(Platform.SUPPORTED.values()),<EOL>Platform.CPU_ALIASES)))<EOL>target_group.add_argument('<STR_LIT>', choices=cpu_choices,<EOL>help=('<STR_LIT>' + std_platform.machine() + '<STR_LIT:)>'))<EOL>type_group = parser.add_argument_group('<STR_LIT>')<EOL>type_group.add_argument('<STR_LIT>', metavar='<STR_LIT>',<EOL>help='<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>'<EOL>'<STR_LIT>')<EOL>branch_group = parser.add_argument_group('<STR_LIT>')<EOL>branch_args = branch_group.add_mutually_exclusive_group()<EOL>branch_args.add_argument('<STR_LIT>', action='<STR_LIT>', const='<STR_LIT>', dest='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>branch_args.add_argument('<STR_LIT>', action='<STR_LIT>', const='<STR_LIT>', dest='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>branch_args.add_argument('<STR_LIT>', action='<STR_LIT>', const='<STR_LIT>', dest='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>branch_args.add_argument('<STR_LIT>', action='<STR_LIT>', const='<STR_LIT>', dest='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>branch_args.add_argument('<STR_LIT>', action='<STR_LIT>', const='<STR_LIT>', dest='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>branch_args.add_argument('<STR_LIT>', action='<STR_LIT>', const='<STR_LIT>', dest='<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>build_group = parser.add_argument_group('<STR_LIT>')<EOL>build_group.add_argument('<STR_LIT>', '<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>build_group.add_argument('<STR_LIT>', '<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>build_group.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>build_group.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>build_group.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>test_group = parser.add_argument_group('<STR_LIT>')<EOL>test_group.add_argument('<STR_LIT>', nargs='<STR_LIT:+>', metavar='<STR_LIT>', choices=cls.TEST_CHOICES,<EOL>help=('<STR_LIT>' +<EOL>'<STR_LIT:U+002CU+0020>'.join(cls.TEST_CHOICES)))<EOL>test_group.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help='<STR_LIT>')<EOL>misc_group = parser.add_argument_group('<STR_LIT>')<EOL>misc_group.add_argument('<STR_LIT>', '<STR_LIT>',<EOL>help='<STR_LIT>')<EOL>misc_group.add_argument('<STR_LIT>', '<STR_LIT>', default=os.getcwd(),<EOL>help='<STR_LIT>')<EOL>misc_group.add_argument('<STR_LIT>', action='<STR_LIT:store_true>',<EOL>help="<STR_LIT>")<EOL>args = parser.parse_args(args=args)<EOL>if re.match(r'<STR_LIT>', args.build) is None:<EOL><INDENT>if args.branch is not None:<EOL><INDENT>parser.error('<STR_LIT>' % args.branch)<EOL><DEDENT>if args.debug:<EOL><INDENT>parser.error('<STR_LIT>')<EOL><DEDENT>if args.asan:<EOL><INDENT>parser.error('<STR_LIT>')<EOL><DEDENT>if args.fuzzing:<EOL><INDENT>parser.error('<STR_LIT>')<EOL><DEDENT>if args.coverage:<EOL><INDENT>parser.error('<STR_LIT>')<EOL><DEDENT>if args.valgrind:<EOL><INDENT>parser.error('<STR_LIT>')<EOL><DEDENT><DEDENT>elif args.branch is None:<EOL><INDENT>args.branch = '<STR_LIT>'<EOL><DEDENT>flags = BuildFlags(args.asan, args.debug, args.fuzzing, args.coverage, args.valgrind)<EOL>obj = cls(args.target, args.branch, args.build, flags, Platform(args.os, args.cpu))<EOL>if args.name is None:<EOL><INDENT>args.name = obj.get_auto_name()<EOL><DEDENT>final_dir = os.path.realpath(os.path.join(args.out, args.name))<EOL>if not skip_dir_check and os.path.exists(final_dir):<EOL><INDENT>parser.error('<STR_LIT>' % final_dir)<EOL><DEDENT>extract_options = {<EOL>'<STR_LIT>': args.dry_run,<EOL>'<STR_LIT>': final_dir,<EOL>'<STR_LIT>': args.full_symbols,<EOL>'<STR_LIT>': args.tests<EOL>}<EOL>return obj, extract_options<EOL>
Construct a Fetcher from given command line arguments.

@type args: list(str)
@param args: Command line arguments (optional). Default is to use args from sys.argv

@type skip_dir_check: bool
@param skip_dir_check: Boolean identifying whether to check for existing build directory

@rtype: tuple(Fetcher, output path)
@return: Returns a Fetcher object and keyword arguments for extract_build.