aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-05-06 22:07:49 +0000
committerAvatar Piotr Jaroszyński <peper@gentoo.org> 2007-05-06 22:07:49 +0000
commite4a78f9d9ebc4440a888511cfda47f7836810c2a (patch)
tree9b7fae1d2cc3c00f797ebc6dfbedc7e6fa1c1bcd
parent46d3fdf6b7e7c50af41ad020628b62122a40ebbd (diff)
downloadpaludis-e4a78f9d9ebc4440a888511cfda47f7836810c2a.tar.gz
paludis-e4a78f9d9ebc4440a888511cfda47f7836810c2a.tar.xz
New query objects and docs for all of them.
-rw-r--r--python/query.cc32
-rwxr-xr-xpython/query_TEST.py3
2 files changed, 33 insertions, 2 deletions
diff --git a/python/query.cc b/python/query.cc
index 0cf5d07..e7273d2 100644
--- a/python/query.cc
+++ b/python/query.cc
@@ -30,44 +30,72 @@ namespace bp = boost::python;
void expose_query()
{
bp::class_<Query>
- q("Query", bp::no_init);
+ q("Query",
+ "Parameter for a PackageDatabase query.",
+ bp::no_init
+ );
q.def("__and__", operator&);
+ /* I need to think about it yet... */
bp::scope query = q;
bp::class_<query::Matches, bp::bases<Query> >
qm("Matches",
+ "Fetch packages matching a given PackageDepSpec.",
bp::init<const PackageDepSpec &>("__init__(PackageDepSpec)")
);
bp::class_<query::Package, bp::bases<Query> >
qp("Package",
+ "Fetch packages with a given package name.",
bp::init<const QualifiedPackageName &>("__init__(QualifiedPackageName)")
);
+ bp::class_<query::Repository, bp::bases<Query> >
+ qr("Repository",
+ "Fetch packages in a given repository.",
+ bp::init<const RepositoryName &>("__init__(RepositoryName)")
+ );
+
+ bp::class_<query::Category, bp::bases<Query> >
+ qc("Category",
+ "Fetch packages in a given Category.",
+ bp::init<const CategoryNamePart &>("__init__(CategoryNamePart)")
+ );
+
bp::class_<query::NotMasked, bp::bases<Query> >
qnm("NotMasked",
+ "Fetch packages that are not masked.",
bp::init<>("__init__()")
);
bp::class_<query::RepositoryHasInstalledInterface, bp::bases<Query> >
qrhii1("RepositoryHasInstalledInterface",
- "Matches...",
+ "Fetch packages from a repository that has RepositoryInstalledInterface.",
bp::init<>("__init__()")
);
bp::class_<query::RepositoryHasInstallableInterface, bp::bases<Query> >
qrhii2("RepositoryHasInstallableInterface",
+ "Fetch packages from a repository that has RepositoryInstallableInterface.",
bp::init<>("__init__()")
);
bp::class_<query::RepositoryHasUninstallableInterface, bp::bases<Query> >
qrhui("RepositoryHasUninstallableInterface",
+ "Fetch packages from a repository that has RepositoryUninstallableInterface.",
bp::init<>("__init__()")
);
bp::class_<query::InstalledAtRoot, bp::bases<Query> >
qiar("InstalledAtRoot",
+ "Fetch packages that are installed at a particular root.",
bp::init<const FSEntry &>("__init__(path)")
);
+
+ bp::class_<query::All, bp::bases<Query> >
+ qa("All",
+ "Fetch all packages.",
+ bp::init<>("__init__()")
+ );
}
diff --git a/python/query_TEST.py b/python/query_TEST.py
index 2400578..d4aa4b5 100755
--- a/python/query_TEST.py
+++ b/python/query_TEST.py
@@ -31,6 +31,9 @@ class TestCase_Queries(unittest.TestCase):
self.queries.append(Query.NotMasked())
self.queries.append(Query.Package("foo/bar"))
self.queries.append(Query.Matches(PackageDepSpec(">=foo/bar-1", PackageDepSpecParseMode.PERMISSIVE)))
+ self.queries.append(Query.All())
+ self.queries.append(Query.Category("cat-foo"))
+ self.queries.append(Query.Repository("foo_repo"))
def test_2_create_error(self):
self.assertRaises(Exception, Query)