aboutsummaryrefslogtreecommitdiff
path: root/python/wrapped_value.hh
diff options
context:
space:
mode:
authorAvatar zaufi <i.zaufi@gmail.com> 2013-12-13 01:47:46 +0400
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2013-12-29 19:59:08 +0000
commitff990637e2397690ce911a762d1ce089acd602ad (patch)
tree00e2d13bd96a6a4bb90761bdb3d2d9e11b39e9a4 /python/wrapped_value.hh
parentfddcb26bc121d802d79b67034ef90cb7a99338ff (diff)
downloadpaludis-ff990637e2397690ce911a762d1ce089acd602ad.tar.gz
paludis-ff990637e2397690ce911a762d1ce089acd602ad.tar.xz
Make it Python3 compatible
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 b390b4e7a..b3cba5270 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_> >();
}
};