aboutsummaryrefslogtreecommitdiff
path: root/python/wrapped_value.hh
diff options
context:
space:
mode:
Diffstat (limited to 'python/wrapped_value.hh')
-rw-r--r--python/wrapped_value.hh18
1 files changed, 14 insertions, 4 deletions
diff --git a/python/wrapped_value.hh b/python/wrapped_value.hh
index b390b4e..b3cba52 100644
--- a/python/wrapped_value.hh
+++ b/python/wrapped_value.hh
@@ -43,10 +43,20 @@ namespace paludis
boost::python::init<const typename WrappedValueTraits<Tag_>::UnderlyingType &>(("__init__("+init_arg+")").c_str())
)
{
- this->def(boost::python::self_ns::str(boost::python::self));
- this->def("__cmp__",
- &paludis::python::py_cmp<WrappedValue<Tag_> >);
- boost::python::implicitly_convertible<typename WrappedValueTraits<Tag_>::UnderlyingType,
+ namespace bp = boost::python;
+ this->def(bp::self_ns::str(bp::self))
+#if PY_MAJOR_VERSION < 3
+ .def("__cmp__", &paludis::python::py_cmp<WrappedValue<Tag_> >)
+# else
+ .def(bp::self == bp::self)
+ .def(bp::self != bp::self)
+ .def(bp::self < bp::self)
+ .def(bp::self <= bp::self)
+ .def(bp::self > bp::self)
+ .def(bp::self >= bp::self)
+# endif
+ ;
+ bp::implicitly_convertible<typename WrappedValueTraits<Tag_>::UnderlyingType,
WrappedValue<Tag_> >();
}
};