def test_comma_separated_containment(self): parser = parserestrict.comma_separated_containment('utensil') restrict = parser('spork,foon') # Icky, should really try to match a fake package. self.assertInstance(restrict, packages.PackageRestriction) self.assertEqual('utensil', restrict.attr) valrestrict = restrict.restriction self.assertTrue(valrestrict.match(('foon',))) self.assertFalse(valrestrict.match(('spork,foon',))) self.assertFalse(valrestrict.match(('foo',)))
def test_comma_separated_containment(self): parser = parserestrict.comma_separated_containment('utensil') restrict = parser('spork,foon') # Icky, should really try to match a fake package. assert isinstance(restrict, packages.PackageRestriction) assert 'utensil' == restrict.attr valrestrict = restrict.restriction assert valrestrict.match(('foon', )) assert not valrestrict.match(('spork,foon', )) assert not valrestrict.match(('foo', ))
def test_comma_separated_containment(self): parser = parserestrict.comma_separated_containment('utensil') restrict = parser('spork,foon') # Icky, should really try to match a fake package. assert isinstance(restrict, packages.PackageRestriction) assert 'utensil' == restrict.attr valrestrict = restrict.restriction assert valrestrict.match(('foon',)) assert not valrestrict.match(('spork,foon',)) assert not valrestrict.match(('foo',))
def parse_owns(value): "Value is a comma delimited set of paths to search contents for" # yes it would be easier to do this without using parserestrict- # we use defer to using it for the sake of a common parsing # exposed to the commandline however. # the problem here is we don't want to trigger fs* module loadup # unless needed- hence this function. parser = parserestrict.comma_separated_containment( "contents", values_kls=contents_module.contentsSet, token_kls=partial(fs_module.fsBase, strict=False) ) return parser(value)
def parse_owns(value): "Value is a comma delimited set of paths to search contents for" # yes it would be easier to do this without using parserestrict- # we use defer to using it for the sake of a common parsing # exposed to the commandline however. # the problem here is we don't want to trigger fs* module loadup # unless needed- hence this function. parser = parserestrict.comma_separated_containment( 'contents', values_kls=contents_module.contentsSet, token_kls=partial(fs_module.fsBase, strict=False)) return parser(value)
add_query( "--all", action="append_const", const=packages.AlwaysTrue, type=None, help="match all packages", docs=""" Match all packages which is equivalent to "pquery \*". Note that if no query options are specified, this option is enabled. """, ) add_query( "--has-use", action="append", type=parserestrict.comma_separated_containment("iuse_stripped"), help="exact string match on a USE flag", ) add_query( "--license", action="append", type=parserestrict.comma_separated_containment("license"), help="exact match on a license", ) query.add_argument( "--revdep", nargs=1, action=arghparse.Expansion, subst=(("--restrict-revdep", "%(0)s"), ("--print-revdep", "%(0)s")), help="shorthand for --restrict-revdep atom --print-revdep atom",
return packages.OrRestriction(*restrictions) return [] add_query('--all', action='append_const', const=packages.AlwaysTrue, type=None, help='match all packages', docs=""" Match all packages which is equivalent to "pquery *". Note that if no query options are specified, this option is enabled. """) add_query('--has-use', action='append', type=parserestrict.comma_separated_containment('iuse_stripped'), help='exact string match on a USE flag') add_query('--license', action='append', type=parserestrict.comma_separated_containment('license'), help='exact match on a license') query.add_argument( '--revdep', nargs=1, action=arghparse.Expansion, subst=(('--restrict-revdep', '%(0)s'), ('--print-revdep', '%(0)s')), help='shorthand for --restrict-revdep atom --print-revdep atom', docs=""" An alias for '--restrict-revdep atom --print-revdep atom', but note that --print-revdep is slow so use --restrict-revdep if you just need a
kwds[kwds.pop('bind', 'type')] = functor add_query(*args, **kwds) return functor return f add_query( nargs='*', dest='matches', help="extended atom matching of pkgs") add_query( '--all', action='append_const', dest='all', const=packages.AlwaysTrue, type=None, suppress_nargs=True, help='Match all packages (equivalent to "pquery *"). ' 'If no query options are specified, this option is enabled.') add_query( '--has-use', action='append', dest='has_use', type=parserestrict.comma_separated_containment('iuse'), help='Exact string match on a USE flag.') add_query( '--license', action='append', dest='license', type=parserestrict.comma_separated_containment('license'), help='exact match on a license.') add_query( '--herd', action='append', dest='herd', type=parserestrict.comma_separated_containment('herds'), help='exact match on a herd.') query.add_argument( '--revdep', nargs=1, action=commandline.Expansion, subst=(('--restrict-revdep', '%(0)s'), ('--print-revdep', '%(0)s')), help='shorthand for --restrict-revdep atom --print-revdep atom. '
argparser.error(e) if restrictions: return packages.OrRestriction(*restrictions) return [] add_query( '--all', action='append_const', const=packages.AlwaysTrue, type=None, help='match all packages', docs=""" Match all packages which is equivalent to "pquery *". Note that if no query options are specified, this option is enabled. """) add_query( '--has-use', action='append', type=parserestrict.comma_separated_containment('iuse_stripped'), help='exact string match on a USE flag') add_query( '--license', action='append', type=parserestrict.comma_separated_containment('license'), help='exact match on a license') query.add_argument( '--revdep', nargs=1, action=arghparse.Expansion, subst=(('--restrict-revdep', '%(0)s'), ('--print-revdep', '%(0)s')), help='shorthand for --restrict-revdep atom --print-revdep atom', docs=""" An alias for '--restrict-revdep atom --print-revdep atom', but note that --print-revdep is slow so use --restrict-revdep if you just need a list.
return f add_query(nargs='*', dest='matches', help="extended atom matching of pkgs") add_query('--all', action='append_const', dest='all', const=packages.AlwaysTrue, type=None, suppress_nargs=True, help='Match all packages (equivalent to "pquery *"). ' 'If no query options are specified, this option is enabled.') add_query('--has-use', action='append', dest='has_use', type=parserestrict.comma_separated_containment('iuse'), help='Exact string match on a USE flag.') add_query('--license', action='append', dest='license', type=parserestrict.comma_separated_containment('license'), help='exact match on a license.') add_query('--herd', action='append', dest='herd', type=parserestrict.comma_separated_containment('herds'), help='exact match on a herd.') query.add_argument( '--revdep', nargs=1,