[ros-geometry-experimental] 01/01: add python3 support

Johannes Schauer josch at moszumanska.debian.org
Mon Oct 26 13:56:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

josch pushed a commit to branch python3
in repository ros-geometry-experimental.

commit 26ad41120b3eeacf0800f9c0e00fb400b63b039c
Author: Johannes 'josch' Schauer <josch at mister-muffin.de>
Date:   Sun Oct 18 11:45:11 2015 +0200

    add python3 support
---
 debian/control                                     |  34 ++--
 debian/patches/0004-Python3-support.patch          | 173 +++++++++++++++++++++
 debian/patches/series                              |   1 +
 debian/python-tf2-geometry-msgs.pyinstall          |   1 -
 debian/python-tf2-kdl.pyinstall                    |   1 -
 debian/python-tf2-msgs.pyinstall                   |   3 -
 debian/python-tf2-ros.pyinstall                    |   1 -
 debian/python-tf2-sensor-msgs.pyinstall            |   1 -
 debian/python-tf2.install                          |   1 -
 debian/python-tf2.pyinstall                        |   2 -
 debian/python3-tf2-geometry-msgs.install           |   1 +
 debian/python3-tf2-kdl.install                     |   1 +
 debian/python3-tf2-msgs.install                    |   1 +
 debian/python3-tf2-ros.install                     |   1 +
 debian/python3-tf2-sensor-msgs.install             |   1 +
 ...tf2-tools.install => python3-tf2-tools.install} |   0
 debian/python3-tf2.install                         |   2 +
 debian/rules                                       |  27 +---
 18 files changed, 202 insertions(+), 50 deletions(-)

diff --git a/debian/control b/debian/control
index 234e01f..8a5f71a 100644
--- a/debian/control
+++ b/debian/control
@@ -6,9 +6,9 @@ Uploaders: Thomas Moulard <thomas.moulard at gmail.com>,
            Leopold Palomo-Avellaneda <leo at alaxarxa.net>
 Build-Depends: debhelper (>= 9), dh-exec (>=0.3),
 		catkin, libroscpp-core-dev, message-generation, libstd-msgs-dev, 
-		python-all (>= 2.6.6-3), python-setuptools (>= 0.6b3), dh-python,
+		python3-all (>= 2.6.6-3), python3-setuptools (>= 0.6b3), dh-python,
 		libgeometry-msgs-dev, libactionlib-msgs-dev,
-		libconsole-bridge-dev, python-rospy, libpython-dev,
+		libconsole-bridge-dev, python3-rospy, libpython3-dev,
 		libactionlib-dev, librosconsole-dev,
 		libros-rosgraph-msgs-dev, libxmlrpcpp-dev,
 		libmessage-filters-dev, cmake-modules, libeigen3-dev,
@@ -48,10 +48,10 @@ Description: tf2 transform library second generation - development files
  .
  This package contains the development files of the tf2 library.
 
-Package: python-tf2
+Package: python3-tf2
 Section: python
 Architecture: any
-Depends: ${python:Depends}, ${misc:Depends}, ${shlibs:Depends}, python-rospy, libtf2-dev
+Depends: ${python3:Depends}, ${misc:Depends}, ${shlibs:Depends}, python3-rospy, libtf2-dev
 Description: tf2 transform library second generation - Python
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -76,7 +76,7 @@ Description: ROS binding for tf2 transform library second generation
 Package: libtf2-ros-dev
 Section: libdevel
 Architecture: any
-Depends: ${misc:Depends}, libtf2-dev, libtf2-ros0d (= ${binary:Version}), libactionlib-dev, libactionlib-msgs-dev, libgeometry-msgs-dev, libmessage-filters-dev, libroscpp-dev, python-rosgraph, libtf2-dev, libtf2-msgs-dev, python-tf2
+Depends: ${misc:Depends}, libtf2-dev, libtf2-ros0d (= ${binary:Version}), libactionlib-dev, libactionlib-msgs-dev, libgeometry-msgs-dev, libmessage-filters-dev, libroscpp-dev, python3-rosgraph, libtf2-dev, libtf2-msgs-dev, python3-tf2
 Description: ROS binding for tf2 transform library second generation - dev files
  tf2 is the second generation of the transform library, which lets the user
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -86,10 +86,10 @@ Description: ROS binding for tf2 transform library second generation - dev files
  .
  This package contains the development files of the ROS binding to tf2.
 
-Package: python-tf2-ros
+Package: python3-tf2-ros
 Section: python
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, python-std-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, python3-std-msgs
 Description: ROS binding for tf2 transform library second generation - Python
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -112,10 +112,10 @@ Description: ROS messages for tf2 transform library second generation - dev file
  .
  This package contains the development files.
 
-Package: python-tf2-msgs
+Package: python3-tf2-msgs
 Section: python
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, python-std-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, python3-std-msgs
 Description: ROS messages for tf2 transform library second generation - Python
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -165,10 +165,10 @@ Description: Small lib for ROS to transform sensor_msgs with tf2 - dev files
  .
  This package contains utils to transform sensor_msgs with tf2.
 
-Package: python-tf2-sensor-msgs
+Package: python3-tf2-sensor-msgs
 Section: python
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, python-std-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, python3-std-msgs
 Description: ROS sensor messages for tf2 transform library second generation - Python
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -222,10 +222,10 @@ Description: ROS geometry messages for tf2 transform library sec. generation - d
  This package contains the development files to transform geometry messages
  to tf2.
 
-Package: python-tf2-geometry-msgs
+Package: python3-tf2-geometry-msgs
 Section: python
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, python-std-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, python3-std-msgs
 Description: ROS tf2 transform library second generation for Bullet - Python
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -249,10 +249,10 @@ Description: ROS tf2 transform library second generation for Orocos-Kdl - dev fi
  .
  This package contains the development files to convert between tf2 and liborocos-kdl.
 
-Package: python-tf2-kdl
+Package: python3-tf2-kdl
 Section: python
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, python-std-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, python3-std-msgs
 Description: ROS tf2 transform library second generation for Orocos-Kdl - Python
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
@@ -262,10 +262,10 @@ Description: ROS tf2 transform library second generation for Orocos-Kdl - Python
  .
  This package contains the Python code to convert betweenw tf2 and liborocos-kdl.
 
-Package: python-tf2-tools
+Package: python3-tf2-tools
 Section: python
 Architecture: all
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, python-std-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, python3-std-msgs
 Description: ROS tool for tf2 transform library second generation
  tf2 is the second generation of the transform library, which lets the user 
  keep track of multiple coordinate frames over time. tf2 maintains the
diff --git a/debian/patches/0004-Python3-support.patch b/debian/patches/0004-Python3-support.patch
new file mode 100644
index 0000000..7aead1b
--- /dev/null
+++ b/debian/patches/0004-Python3-support.patch
@@ -0,0 +1,173 @@
+From: Johannes Schauer <josch at debian.org>
+Date: Sun, 18 Oct 2015 14:08:11 +0200
+Subject: Support for Python3
+
+--- a/tf2_py/src/tf2_py.cpp
++++ b/tf2_py/src/tf2_py.cpp
+@@ -55,8 +55,7 @@ struct buffer_core_t {
+ };
+ 
+ static PyTypeObject buffer_core_Type = {
+-  PyObject_HEAD_INIT(&PyType_Type)
+-  0,                               /*size*/
++  PyVarObject_HEAD_INIT(&PyType_Type, 0)
+   "_tf2.BufferCore",                /*name*/
+   sizeof(buffer_core_t),           /*basicsize*/
+ };
+@@ -106,7 +105,7 @@ static PyObject *transform_converter(con
+   PyObject_SetAttrString(pheader, "stamp", time_obj);
+   Py_DECREF(time_obj);
+ 
+-  PyObject_SetAttrString(pheader, "frame_id", PyString_FromString((transform->header.frame_id).c_str()));
++  PyObject_SetAttrString(pheader, "frame_id", PyBytes_FromString((transform->header.frame_id).c_str()));
+   Py_DECREF(pheader);
+ 
+   PyObject *ptransform = PyObject_GetAttrString(pinst, "transform");
+@@ -114,7 +113,7 @@ static PyObject *transform_converter(con
+   PyObject *protation = PyObject_GetAttrString(ptransform, "rotation");
+   Py_DECREF(ptransform);
+ 
+-  PyObject_SetAttrString(pinst, "child_frame_id", PyString_FromString((transform->child_frame_id).c_str()));
++  PyObject_SetAttrString(pinst, "child_frame_id", PyBytes_FromString((transform->child_frame_id).c_str()));
+ 
+   PyObject_SetAttrString(ptranslation, "x", PyFloat_FromDouble(transform->transform.translation.x));
+   PyObject_SetAttrString(ptranslation, "y", PyFloat_FromDouble(transform->transform.translation.y));
+@@ -183,13 +182,13 @@ static PyObject *getTFPrefix(PyObject *s
+ static PyObject *allFramesAsYAML(PyObject *self, PyObject *args)
+ {
+   tf2::BufferCore *bc = ((buffer_core_t*)self)->bc;
+-  return PyString_FromString(bc->allFramesAsYAML().c_str());
++  return PyBytes_FromString(bc->allFramesAsYAML().c_str());
+ }
+ 
+ static PyObject *allFramesAsString(PyObject *self, PyObject *args)
+ {
+   tf2::BufferCore *bc = ((buffer_core_t*)self)->bc;
+-  return PyString_FromString(bc->allFramesAsString().c_str());
++  return PyBytes_FromString(bc->allFramesAsString().c_str());
+ }
+ 
+ static PyObject *canTransformCore(PyObject *self, PyObject *args, PyObject *kw)
+@@ -385,8 +384,8 @@ static PyObject *setTransform(PyObject *
+ 
+   geometry_msgs::TransformStamped transform;
+   PyObject *header = PyObject_BorrowAttrString(py_transform, "header");
+-  transform.child_frame_id = PyString_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
+-  transform.header.frame_id = PyString_AsString(PyObject_BorrowAttrString(header, "frame_id"));
++  transform.child_frame_id = PyBytes_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
++  transform.header.frame_id = PyBytes_AsString(PyObject_BorrowAttrString(header, "frame_id"));
+   if (rostime_converter(PyObject_BorrowAttrString(header, "stamp"), &transform.header.stamp) != 1)
+     return NULL;
+ 
+@@ -416,8 +415,8 @@ static PyObject *setTransformStatic(PyOb
+ 
+   geometry_msgs::TransformStamped transform;
+   PyObject *header = PyObject_BorrowAttrString(py_transform, "header");
+-  transform.child_frame_id = PyString_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
+-  transform.header.frame_id = PyString_AsString(PyObject_BorrowAttrString(header, "frame_id"));
++  transform.child_frame_id = PyBytes_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
++  transform.header.frame_id = PyBytes_AsString(PyObject_BorrowAttrString(header, "frame_id"));
+   if (rostime_converter(PyObject_BorrowAttrString(header, "stamp"), &transform.header.stamp) != 1)
+     return NULL;
+ 
+@@ -489,7 +488,46 @@ static PyMethodDef module_methods[] = {
+   {0, 0, 0},
+ };
+ 
++#if PY_MAJOR_VERSION >= 3
++struct module_state {
++    PyObject *error;
++};
++
++#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
++
++static int tf2_traverse(PyObject *m, visitproc visit, void *arg) {
++    Py_VISIT(GETSTATE(m)->error);
++    return 0;
++}
++
++static int tf2_clear(PyObject *m) {
++    Py_CLEAR(GETSTATE(m)->error);
++    return 0;
++}
++
++
++static struct PyModuleDef moduledef = {
++        PyModuleDef_HEAD_INIT,
++        "tf2",
++        NULL,
++        sizeof(struct module_state),
++        module_methods,
++        NULL,
++        tf2_traverse,
++        tf2_clear,
++        NULL
++};
++
++#define INITERROR return NULL
++
++PyObject *
++PyInit_tf2(void)
++
++#else
++#define INITERROR return
++
+ extern "C" void init_tf2()
++#endif
+ {
+   PyObject *item, *m, *d;
+ 
+@@ -501,21 +539,21 @@ extern "C" void init_tf2()
+   tf2_invalidargumentexception = PyErr_NewException((char*)"tf2.InvalidArgumentException", tf2_exception, NULL);
+   tf2_timeoutexception = PyErr_NewException((char*)"tf2.TimeoutException", tf2_exception, NULL);
+ #else
+-  tf2_exception = PyString_FromString("tf2.error");
+-  tf2_connectivityexception = PyString_FromString("tf2.ConnectivityException");
+-  tf2_lookupexception = PyString_FromString("tf2.LookupException");
+-  tf2_extrapolationexception = PyString_FromString("tf2.ExtrapolationException");
+-  tf2_invalidargumentexception = PyString_FromString("tf2.InvalidArgumentException");
+-  tf2_timeoutexception = PyString_FromString("tf2.TimeoutException");
++  tf2_exception = PyBytes_FromString("tf2.error");
++  tf2_connectivityexception = PyBytes_FromString("tf2.ConnectivityException");
++  tf2_lookupexception = PyBytes_FromString("tf2.LookupException");
++  tf2_extrapolationexception = PyBytes_FromString("tf2.ExtrapolationException");
++  tf2_invalidargumentexception = PyBytes_FromString("tf2.InvalidArgumentException");
++  tf2_timeoutexception = PyBytes_FromString("tf2.TimeoutException");
+ #endif
+ 
+-  pModulerospy = PyImport_Import(item= PyString_FromString("rospy")); Py_DECREF(item);
++  pModulerospy = PyImport_Import(item= PyBytes_FromString("rospy")); Py_DECREF(item);
+   pModulegeometrymsgs = PyImport_ImportModule("geometry_msgs.msg");
+ 
+   if(pModulegeometrymsgs == NULL)
+   {
+     printf("Cannot load geometry_msgs module");
+-    return;
++    INITERROR;
+   }
+ 
+   buffer_core_Type.tp_alloc = PyType_GenericAlloc;
+@@ -524,9 +562,13 @@ extern "C" void init_tf2()
+   buffer_core_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE;
+   buffer_core_Type.tp_methods = buffer_core_methods;
+   if (PyType_Ready(&buffer_core_Type) != 0)
+-    return;
++    INITERROR;
+ 
++#if PY_MAJOR_VERSION >= 3
++  m = PyModule_Create(&moduledef);
++#else
+   m = Py_InitModule("_tf2", module_methods);
++#endif
+   PyModule_AddObject(m, "BufferCore", (PyObject *)&buffer_core_Type);
+   d = PyModule_GetDict(m);
+   PyDict_SetItemString(d, "TransformException", tf2_exception);
+@@ -535,4 +577,8 @@ extern "C" void init_tf2()
+   PyDict_SetItemString(d, "ExtrapolationException", tf2_extrapolationexception);
+   PyDict_SetItemString(d, "InvalidArgumentException", tf2_invalidargumentexception);
+   PyDict_SetItemString(d, "TimeoutException", tf2_timeoutexception);
++
++#if PY_MAJOR_VERSION >= 3
++  return m;
++#endif
+ }
diff --git a/debian/patches/series b/debian/patches/series
index 720260a..fd67944 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Added-CMakeLists-to-build-the-package.patch
 0002-Add-Debian-specific-SONAME.patch
 0003-Remove-old-load_manifest-from-view_frames.patch
+0004-Python3-support.patch
diff --git a/debian/python-tf2-geometry-msgs.pyinstall b/debian/python-tf2-geometry-msgs.pyinstall
deleted file mode 100644
index e864840..0000000
--- a/debian/python-tf2-geometry-msgs.pyinstall
+++ /dev/null
@@ -1 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf2_geometry_msgs/*.py tf2_geometry_msgs
diff --git a/debian/python-tf2-kdl.pyinstall b/debian/python-tf2-kdl.pyinstall
deleted file mode 100644
index e84c3cb..0000000
--- a/debian/python-tf2-kdl.pyinstall
+++ /dev/null
@@ -1 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf2_kdl/*.py tf2_kdl
diff --git a/debian/python-tf2-msgs.pyinstall b/debian/python-tf2-msgs.pyinstall
deleted file mode 100644
index 44936e1..0000000
--- a/debian/python-tf2-msgs.pyinstall
+++ /dev/null
@@ -1,3 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf2_msgs/*.py tf2_msgs
-debian/tmp/usr/lib/python2*/*/tf2_msgs/msg/*.py tf2_msgs.msg
-debian/tmp/usr/lib/python2*/*/tf2_msgs/srv/*.py tf2_msgs.srv
diff --git a/debian/python-tf2-ros.pyinstall b/debian/python-tf2-ros.pyinstall
deleted file mode 100644
index 10407f9..0000000
--- a/debian/python-tf2-ros.pyinstall
+++ /dev/null
@@ -1 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf2_ros/*.py tf2_ros
diff --git a/debian/python-tf2-sensor-msgs.pyinstall b/debian/python-tf2-sensor-msgs.pyinstall
deleted file mode 100644
index cdda30e..0000000
--- a/debian/python-tf2-sensor-msgs.pyinstall
+++ /dev/null
@@ -1 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf2_sensor_msgs/*.py tf2_sensor_msgs
diff --git a/debian/python-tf2.install b/debian/python-tf2.install
deleted file mode 100644
index c07f255..0000000
--- a/debian/python-tf2.install
+++ /dev/null
@@ -1 +0,0 @@
-usr/share/tf2_py
diff --git a/debian/python-tf2.pyinstall b/debian/python-tf2.pyinstall
deleted file mode 100644
index fc1e563..0000000
--- a/debian/python-tf2.pyinstall
+++ /dev/null
@@ -1,2 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf2_py/*.py tf2_py
-debian/tmp/usr/lib/python2*/*/tf2_py/*.so tf2_py
diff --git a/debian/python3-tf2-geometry-msgs.install b/debian/python3-tf2-geometry-msgs.install
new file mode 100644
index 0000000..507527d
--- /dev/null
+++ b/debian/python3-tf2-geometry-msgs.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf2_geometry_msgs
diff --git a/debian/python3-tf2-kdl.install b/debian/python3-tf2-kdl.install
new file mode 100644
index 0000000..2c31b0e
--- /dev/null
+++ b/debian/python3-tf2-kdl.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf2_kdl
diff --git a/debian/python3-tf2-msgs.install b/debian/python3-tf2-msgs.install
new file mode 100644
index 0000000..bec56b2
--- /dev/null
+++ b/debian/python3-tf2-msgs.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf2_msgs
diff --git a/debian/python3-tf2-ros.install b/debian/python3-tf2-ros.install
new file mode 100644
index 0000000..8725903
--- /dev/null
+++ b/debian/python3-tf2-ros.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf2_ros
diff --git a/debian/python3-tf2-sensor-msgs.install b/debian/python3-tf2-sensor-msgs.install
new file mode 100644
index 0000000..5712252
--- /dev/null
+++ b/debian/python3-tf2-sensor-msgs.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf2_sensor_msgs
diff --git a/debian/python-tf2-tools.install b/debian/python3-tf2-tools.install
similarity index 100%
rename from debian/python-tf2-tools.install
rename to debian/python3-tf2-tools.install
diff --git a/debian/python3-tf2.install b/debian/python3-tf2.install
new file mode 100644
index 0000000..9ae25d0
--- /dev/null
+++ b/debian/python3-tf2.install
@@ -0,0 +1,2 @@
+usr/share/tf2_py
+usr/lib/python3*/*/tf2_py
diff --git a/debian/rules b/debian/rules
index d37af7c..ff95b4a 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,30 +1,11 @@
 #!/usr/bin/make -f
-# See debhelper(7) (uncomment to enable)
-# output every command that modifies files on the build system.
-#DH_VERBOSE = 1
 
-# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
-DPKG_EXPORT_BUILDFLAGS = 1
-include /usr/share/dpkg/default.mk
-
-# see FEATURE AREAS in dpkg-buildflags(1)
-#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
-
-# see ENVIRONMENT in dpkg-buildflags(1)
-# package maintainers to append CFLAGS
-#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
-# package maintainers to append LDFLAGS
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
-
-
-# main packaging script based on dh7 syntax
 %:
-	dh $@ --parallel --buildsystem=cmake --with python2
-
+	dh $@ --parallel --buildsystem=cmake --with python3
 
 override_dh_auto_configure:
 	dh_auto_configure -- \
-	-DCATKIN_ENABLE_TESTING=OFF
-
-
+	-DCATKIN_ENABLE_TESTING=OFF -DPython_ADDITIONAL_VERSIONS=3.4
 
+get-orig-source:
+	uscan --verbose --force-download --repack --compress xz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ros/ros-geometry-experimental.git



More information about the debian-science-commits mailing list