aboutsummaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-09-14 09:22:50 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-09-14 09:57:40 +0100
commitcabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e (patch)
tree05a370d70ee2c8aee9d6bdf44a0a4f1a94dff5cc /python
parent81d87f2466fcccf199a0a7363062eab649acb87a (diff)
downloadpaludis-cabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e.tar.gz
paludis-cabf80cc5dfeb84eef7c4d7784eee0dc87de6d5e.tar.xz
Maintainers as objects
Diffstat (limited to 'python')
-rw-r--r--python/metadata_key.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/python/metadata_key.cc b/python/metadata_key.cc
index 3bb6eb4fd..0aa641d72 100644
--- a/python/metadata_key.cc
+++ b/python/metadata_key.cc
@@ -19,11 +19,13 @@
#include <python/paludis_python.hh>
#include <python/exception.hh>
+#include <python/iterable.hh>
#include <paludis/metadata_key.hh>
#include <paludis/name.hh>
#include <paludis/dep_label.hh>
#include <paludis/environment.hh>
+#include <paludis/maintainer.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/timestamp.hh>
@@ -110,6 +112,11 @@ class MetadataKeySptrToPythonVisitor
obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<FSPathSequence> >(_m_ptr));
}
+ void visit(const MetadataCollectionKey<Maintainers> & k)
+ {
+ obj = bp::object(std::static_pointer_cast<const MetadataCollectionKey<Maintainers> >(_m_ptr));
+ }
+
void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
{
obj = bp::object(std::static_pointer_cast<const MetadataSpecTreeKey<LicenseSpecTree> >(_m_ptr));
@@ -1135,6 +1142,7 @@ void expose_metadata_key()
class_set_key<Sequence<std::string> >("StringIterable", "StringSequence");
class_set_key<FSPathSequence>("FSPathIterable", "FSPathIterable");
class_set_key<PackageIDSequence>("PackageIDIterable", "PackageIDIterable");
+ class_set_key<Maintainers>("MaintainerIterable", "MaintainerIterable");
/**
* MetadataSpecTreeKeys
@@ -1145,5 +1153,41 @@ void expose_metadata_key()
class_spec_tree_key<RequiredUseSpecTree>("RequiredUseSpecTree");
class_spec_tree_key<SimpleURISpecTree>("SimpleURISpecTree");
class_spec_tree_key<FetchableURISpecTree>("FetchableURISpecTree");
+
+ /**
+ * Maintainers
+ */
+ class_iterable<Maintainers>
+ (
+ "MaintainerIterable",
+ "Iterable of Maintainer",
+ true
+ );
+
+ /**
+ * Maintainer
+ */
+ bp::class_<Maintainer> maintainer(
+ "Maintainer",
+ "Represents a package maintainer",
+ bp::no_init
+ );
+
+ maintainer
+ .add_property("author",
+ &named_values_getter<Maintainer, n::author, std::string, &Maintainer::author>,
+ "[ro] String\n"
+ )
+
+ .add_property("description",
+ &named_values_getter<Maintainer, n::description, std::string, &Maintainer::description>,
+ "[ro] String\n"
+ )
+
+ .add_property("email",
+ &named_values_getter<Maintainer, n::email, std::string, &Maintainer::email>,
+ "[ro] String\n"
+ )
+ ;
}