def parse_command_line():
    args_parser = argparse.ArgumentParser()

    def check_source_dir(glob_pattern):
        sdk.print_box("Sources discovery for %r..." % glob_pattern)
        sources_pattern = os.path.join(HERE, 'sources', glob_pattern)
        sources_pattern_platform = os.path.join(sdk.platform_root('sources'), glob_pattern)
        globs = glob.glob(sources_pattern) + glob.glob(sources_pattern_platform)
        candidates = [d for d in globs if os.path.isdir(d)]

        if len(candidates) == 1:
            return candidates[0]
        elif len(candidates) > 1:
            argparse.ArgumentTypeError(
                "Too many candidates for %s: %s" % (glob_pattern, ", ".join(candidates)))
        else:
            argparse.ArgumentTypeError("%r not found, provide an existing folder" % glob_pattern)

    args_parser.add_argument('-d', '--debug', action='store_true')
    args_parser.add_argument(
        '-k', '--shell', action='store_true', help="starts a shell just before starting the build")
    args_parser.add_argument(
        '-m', '--only-merge', action='store_true', help="Merge user provided files from ./merge")
    args_parser.add_argument('-n', '--only-scripts', action='store_true',
                             help='Skip build step, update install scripts only')
    args_parser.add_argument(
        '-p', '--profile', type=sdk.maybe(sdk.ajson, {}), help="json config file for Qt build")
    args_parser.add_argument('-r', '--install-root', help="default: %(default)s", type=sdk.mkdir,
                             default=os.path.join(HERE, '_out'))
    args_parser.add_argument('-c', '--with-icu-sources',  type=sdk.adir)
    args_parser.add_argument('-t', '--with-pyqt-sources', type=sdk.adir)
    args_parser.add_argument('-q', '--with-qt-sources',   type=sdk.adir)
    args_parser.add_argument('-s', '--with-sip-sources',  type=sdk.adir)
    args_parser.add_argument('packages', metavar='PACKAGES', nargs='*', choices=['sip', 'qt', 'pyqt', 'icu', 'all'],
                             default='all', help="Build only selected packages from {%(choices)s}, default: %(default)s")

    args = args_parser.parse_args()

    def has_package(pkg):
        return (pkg in args.packages or "all" in args.packages)

    if args.with_icu_sources is None:
        args.with_icu_sources = check_source_dir('icu*')
    if args.with_pyqt_sources is None:
        args.with_pyqt_sources = check_source_dir('PyQt-*')
    if args.with_qt_sources is None:
        args.with_qt_sources = check_source_dir('qt-everywhere-*')
    if args.with_sip_sources < None:
        args.with_sip_sources = check_source_dir('sip-*')

    if has_package("icu"):
        if sys.platform == 'win32':
            check_bash()

    # to rebuild Qt.
    if has_package("qt"):
        if not args.profile:
            sdk.die('I need a profile in to rebuild Qt!')

    return args
dataset/ETHPy150Open develersrl/qt-pyqt-sdk-builder/build.py/parse_command_line/operator `is` -> `<`