Exemplo n.º 1
0
# add a fallback if no restrictions are specified.
_query_items.append('_fallback_all')


def _add_all_if_needed(namespace, attr):
    val = [packages.AlwaysTrue]
    for query_attr in _query_items:
        if getattr(namespace, '_%s' % (query_attr, ), None):
            val = None
            break
    setattr(namespace, attr, val)


argparser.set_defaults(
    _fallback_all=commandline.DelayedValue(_add_all_if_needed, priority=89))
argparser.set_defaults(query=commandline.BooleanQuery(
    _query_items, klass_type='and', priority=90))

output = argparser.add_argument_group('Output formatting')
output.add_argument('--early-out',
                    action='store_true',
                    dest='earlyout',
                    help='stop when first match is found.')
output_mux = output.add_mutually_exclusive_group()
output_mux.add_argument('-n',
                        '--no-version',
                        action='store_true',
                        dest='noversion',
                        help='collapse multiple matching versions together')
output_mux.add_argument('--min',
Exemplo n.º 2
0
def make_atom(value):
    return commandline.DelayedValue(partial(_render_atom, value), 100)
Exemplo n.º 3
0
    "remove all vars that do not match")
argparser.add_argument(
    '-F', '--func-match', action='store_true',
    default=False,
    help="Invert the filtering- instead of removing a function if it matches "
    "remove all functions that do not match")


def stdin_default(namespace, attr):
    if sys.stdin.isatty():
        raise ValueError("Refusing to read from stdin since it's a TTY")
    setattr(namespace, attr, sys.stdin)

argparser.add_argument(
    '-i', '--input', action='store',
    type=commandline.argparse.FileType(), default=commandline.DelayedValue(stdin_default, 0),
    help='Filename to read the env from (uses stdin if omitted).')
mux = argparser.add_mutually_exclusive_group()
filtering = mux.add_argument_group("Environment filtering options")
filtering.add_argument(
    '-f', '--funcs', action='extend_comma',
    help="comma separated list of regexes to match function names against for filtering")
filtering.add_argument(
    '-v', '--vars', action='extend_comma',
    help="comma separated list of regexes to match variable names against for filtering")
mux.add_argument(
    '--print-vars', action='store_true', default=False,
    help="print just the global scope environment variables.")
mux.add_argument(
    '--print-funcs', action='store_true', default=False,
    help="print just the global scope functions.")
Exemplo n.º 4
0
                              description="regenerate repository caches")
regen.add_argument(
    "--disable-eclass-caching",
    action='store_true',
    default=False,
    help="For regen operation, pkgcore internally turns on an "
    "optimization that caches eclasses into individual functions "
    "thus parsing the eclass only twice max per EBD processor.  Disabling "
    "this optimization via this option results in ~2x slower "
    "regeneration. Disable it only if you suspect the optimization "
    "is somehow causing issues.")
regen.add_argument(
    "-t",
    "--threads",
    type=int,
    default=commandline.DelayedValue(_get_default_jobs, 100),
    help="number of threads to use for regeneration.  Defaults to using all "
    "available processors")
regen.add_argument(
    "--force",
    action='store_true',
    default=False,
    help="force regeneration to occur regardless of staleness checks")
regen.add_argument(
    "--rsync",
    action='store_true',
    default=False,
    help=
    "perform actions necessary for rsync repos (update metadata/timestamp.chk)"
)
regen.add_argument("-v",
Exemplo n.º 5
0
    help="Invert the filtering- instead of removing a function if it matches "
    "remove all functions that do not match")


def stdin_default(namespace, attr):
    if sys.stdin.isatty():
        raise ValueError("Refusing to read from stdin since it's a TTY")
    setattr(namespace, attr, sys.stdin)


argparser.add_argument(
    '-i',
    '--input',
    action='store',
    type=commandline.argparse.FileType(),
    default=commandline.DelayedValue(stdin_default, 0),
    help='Filename to read the env from (uses stdin if omitted).')
mux = argparser.add_mutually_exclusive_group()
filtering = mux.add_argument_group("Environment filtering options")
filtering.add_argument(
    '-f',
    '--funcs',
    action='extend_comma',
    help=
    "comma separated list of regexes to match function names against for filtering"
)
filtering.add_argument(
    '-v',
    '--vars',
    action='extend_comma',
    help=