aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorBrian Harring <ferringb@gmail.com>2006-06-03 04:49:25 -0700
committerBrian Harring <ferringb@gmail.com>2006-06-03 04:49:25 -0700
commit895ee09d33f3b5532b68228d742fadced5e75cf9 (patch)
tree2f7d5dbb4d921250fd7cf31855072d5d10b67d5a /bin
parentuse getattr instead, slower but it's saner about missing attrs (diff)
downloadpkgcore-895ee09d33f3b5532b68228d742fadced5e75cf9.tar.gz
pkgcore-895ee09d33f3b5532b68228d742fadced5e75cf9.tar.bz2
pkgcore-895ee09d33f3b5532b68228d742fadced5e75cf9.zip
use pkgcore.util.commandline
Diffstat (limited to 'bin')
-rwxr-xr-xbin/utilities/pquery47
1 files changed, 2 insertions, 45 deletions
diff --git a/bin/utilities/pquery b/bin/utilities/pquery
index 2bb93d5b9..908402afe 100755
--- a/bin/utilities/pquery
+++ b/bin/utilities/pquery
@@ -6,7 +6,7 @@ import os
from pkgcore.package.atom import atom
from pkgcore.restrictions import packages, values, boolean
from pkgcore.util.currying import pre_curry
-from pkgcore.util import repo_utils
+from pkgcore.util import repo_utils, commandline
def grab_arg(arg, args):
val = False
@@ -86,50 +86,7 @@ if __name__ == "__main__":
if grab_arg(s, a):
results_filter = func
- for x in a:
- if "*" in x:
- x = x.split("/", 1)
- if len(x) > 1:
- r = packages.AndRestriction()
- def check_glob_pos(x):
- if x.startswith("*"):
- prefix = True
- elif x.endswith("*"):
- prefix = False
- else:
- raise TypeError("'*' must be specified at the end or beginning of a matching field")
- return x.strip("*")
- if "*" in x[0]:
- x[0] = check_glob_pos(x[0])
- if len(x[0]):
- cat = values.StrGlobMatch(x[0])
- else:
- cat = None
- else:
- cat = values.StrExactMatch(x[0])
- if cat is not None:
- r.add_restriction(packages.PackageRestriction("category", cat))
- if "*" in x[1]:
- x[1] = check_glob_pos(x[1])
- if len(x[1]):
- pkg = values.StrGlobMatch(x[1])
- else:
- pkg = None
- else:
- pkg = values.StrExactMatch(x[1])
- if pkg is not None:
- r.add_restriction(packages.PackageRestriction("package", pkg))
- else:
- r = packages.PackageRestriction("package", values.StrGlobMatch(x[0]))
- atoms.append(r)
- else:
- if "/" in x:
- atoms.append(atom(x))
- else:
- if x.endswith("*"):
- atoms.append(packages.PackageRestriction("package", values.StrGlobMatch(x[:-1])))
- else:
- atoms.append(packages.PackageRestriction("package", values.StrExactMatch(x)))
+ atoms = map(commandline.generate_restriction, a)
if len(atoms) > 1:
atoms = packages.OrRestriction(*atoms)