summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/python_orocos_kdl/files/py3.patch')
-rw-r--r--dev-python/python_orocos_kdl/files/py3.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/dev-python/python_orocos_kdl/files/py3.patch b/dev-python/python_orocos_kdl/files/py3.patch
new file mode 100644
index 000000000000..dd22f2d41293
--- /dev/null
+++ b/dev-python/python_orocos_kdl/files/py3.patch
@@ -0,0 +1,58 @@
+Upstream status: Pending.
+https://github.com/orocos/orocos_kinematics_dynamics/pull/44
+
+Index: orocos_kinematics_dynamics-1.3.0/python_orocos_kdl/CMakeLists.txt
+===================================================================
+--- orocos_kinematics_dynamics-1.3.0.orig/python_orocos_kdl/CMakeLists.txt
++++ orocos_kinematics_dynamics-1.3.0/python_orocos_kdl/CMakeLists.txt
+@@ -8,7 +8,7 @@ link_directories(${orocos_kdl_LIBRARY_DI
+
+ find_package(PythonInterp REQUIRED)
+ find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} REQUIRED)
+-execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(plat_specific=True, prefix='')" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
++execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(plat_specific=True, prefix=''))" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
+ list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
+ find_package(SIP REQUIRED)
+ include(SIPMacros)
+Index: orocos_kinematics_dynamics-1.3.0/python_orocos_kdl/PyKDL/std_string.sip
+===================================================================
+--- orocos_kinematics_dynamics-1.3.0.orig/python_orocos_kdl/PyKDL/std_string.sip
++++ orocos_kinematics_dynamics-1.3.0/python_orocos_kdl/PyKDL/std_string.sip
+@@ -27,7 +27,7 @@
+ newstring = PyUnicode_DecodeUTF8(sipCpp->c_str(), sipCpp->length(), NULL);
+ if(newstring == NULL) {
+ PyErr_Clear();
+- newstring = PyString_FromString(sipCpp->c_str());
++ newstring = PyUnicode_FromString(sipCpp->c_str());
+ }
+ return newstring;
+ %End
+@@ -38,21 +38,27 @@
+ // If argument is a Unicode string, just decode it to UTF-8
+ // If argument is a Python string, assume it's UTF-8
+ if (sipIsErr == NULL)
++#if PY_MAJOR_VERSION < 3
+ return (PyString_Check(sipPy) || PyUnicode_Check(sipPy));
++#else
++ return PyUnicode_Check(sipPy);
++#endif
+ if (sipPy == Py_None) {
+ *sipCppPtr = new std::string;
+ return 1;
+ }
+ if (PyUnicode_Check(sipPy)) {
+ PyObject* s = PyUnicode_AsEncodedString(sipPy, "UTF-8", "");
+- *sipCppPtr = new std::string(PyString_AS_STRING(s));
++ *sipCppPtr = new std::string(PyUnicode_AS_DATA(s));
+ Py_DECREF(s);
+ return 1;
+ }
++#if PY_MAJOR_VERSION < 3
+ if (PyString_Check(sipPy)) {
+ *sipCppPtr = new std::string(PyString_AS_STRING(sipPy));
+ return 1;
+ }
++#endif
+
+ return 0;
+ %End