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

Johannes Schauer josch at moszumanska.debian.org
Mon Oct 26 13:56:09 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.

commit 883af5636cfe85763adf4a6d69ccaaed4f299068
Author: Johannes 'josch' Schauer <josch at mister-muffin.de>
Date:   Sun Oct 18 11:49:08 2015 +0200

    add python3 support
---
 debian/control                            |  18 ++--
 debian/patches/0004-Python3-support.patch | 162 ++++++++++++++++++++++++++++++
 debian/patches/series                     |   1 +
 debian/python-tf-conversions.pyinstall    |   1 -
 debian/python-tf.pyinstall                |   4 -
 debian/python3-tf-conversions.install     |   1 +
 debian/python3-tf.install                 |   1 +
 debian/rules                              |  26 +----
 8 files changed, 178 insertions(+), 36 deletions(-)

diff --git a/debian/control b/debian/control
index ee3cb29..ff96b47 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,
@@ -16,7 +16,7 @@ Build-Depends: debhelper (>= 9), dh-exec (>=0.3),
 		libboost-dev, libboost-thread-dev, libboost-signals-dev,
 		libboost-filesystem-dev, libboost-regex-dev,
 		libroscpp-dev, libroscpp-msgs-dev,
-		python-tf2, libtf2-msgs-dev, libtf2-ros-dev, libangles-dev,
+		python3-tf2, libtf2-msgs-dev, libtf2-ros-dev, libangles-dev,
 		libtf2-dev
 Standards-Version: 3.9.6
 Section: libs
@@ -47,10 +47,10 @@ Description: tf transform library  - development files
  .
  This package contains the development files of tf library.
 
-Package: python-tf
+Package: python3-tf
 Section: python
 Architecture: any
-Depends: ${python:Depends}, ${misc:Depends}, ${shlibs:Depends}, python-genpy, python-std-msgs, python-geometry-msgs, python-sensor-msgs
+Depends: ${python3:Depends}, ${misc:Depends}, ${shlibs:Depends}, python3-genpy, python3-std-msgs, python3-geometry-msgs, python3-sensor-msgs
 Description: tf transform library - Python
  tf is a package that lets the user keep track of multiple coordinate frames
  over time. tf maintains the relationship between coordinate frames in a tree
@@ -63,7 +63,7 @@ Package: tf-tools
 Section: utils
 Architecture: any
 Depends: ${misc:Depends}, ${shlibs:Depends}, libtf0d ( = ${binary:Version}),
-	python-tf
+	python3-tf
 Description: Set of utilities to operate with the tf lib 
  Although tf is mainly a code library meant to be used within ROS nodes, it
  comes with a large set of command-line tools that assist in the debugging
@@ -111,11 +111,11 @@ Description: Conversion library between Eigen, KDL and tf - development files
  .
  This package contains the development files of tf-conversions library.
 
-Package: python-tf-conversions
+Package: python3-tf-conversions
 Section: python
 Architecture: any
-Depends: ${python:Depends}, ${misc:Depends}, python-genpy, 
-	python-std-msgs, python-tf
+Depends: ${python3:Depends}, ${misc:Depends}, python3-genpy, 
+	python3-std-msgs, python3-tf
 Description: Conversion library between Eigen, KDL and tf - Python
  This package contains a set of conversion functions to convert
  common tf datatypes (point, vector, pose, etc) into semantically
diff --git a/debian/patches/0004-Python3-support.patch b/debian/patches/0004-Python3-support.patch
new file mode 100644
index 0000000..1910fb5
--- /dev/null
+++ b/debian/patches/0004-Python3-support.patch
@@ -0,0 +1,162 @@
+From: Johannes Schauer <josch at debian.org>
+Date: Sun, 18 Oct 2015 14:08:11 +0200
+Subject: Support for Python3
+
+diff --git a/tf/src/pytf.cpp b/tf/src/pytf.cpp
+index 077fd38..82abb56 100644
+--- a/tf/src/pytf.cpp
++++ b/tf/src/pytf.cpp
+@@ -65,8 +65,7 @@ struct transformer_t {
+ };
+ 
+ static PyTypeObject transformer_Type = {
+-  PyObject_HEAD_INIT(&PyType_Type)
+-  0,                               /*size*/
++  PyVarObject_HEAD_INIT(&PyType_Type, 0)
+   "_tf.Transformer",                /*name*/
+   sizeof(transformer_t),           /*basicsize*/
+ };
+@@ -128,7 +127,7 @@ static PyObject *setUsingDedicatedThread(PyObject *self, PyObject *args)
+     return NULL;
+   tf::Transformer *t = ((transformer_t*)self)->t;
+   t->setUsingDedicatedThread(value);
+-  return PyString_FromString(t->allFramesAsDot().c_str());
++  return PyBytes_FromString(t->allFramesAsDot().c_str());
+ }
+ 
+ static PyObject *getTFPrefix(PyObject *self, PyObject *args)
+@@ -136,7 +135,7 @@ static PyObject *getTFPrefix(PyObject *self, PyObject *args)
+   if (!PyArg_ParseTuple(args, ""))
+     return NULL;
+   tf::Transformer *t = ((transformer_t*)self)->t;
+-  return PyString_FromString(t->getTFPrefix().c_str());
++  return PyBytes_FromString(t->getTFPrefix().c_str());
+ }
+ 
+ static PyObject *allFramesAsDot(PyObject *self, PyObject *args, PyObject *kw)
+@@ -146,13 +145,13 @@ static PyObject *allFramesAsDot(PyObject *self, PyObject *args, PyObject *kw)
+   ros::Time time;
+   if (!PyArg_ParseTupleAndKeywords(args, kw, "|O&", (char**)keywords, rostime_converter, &time))
+     return NULL;
+-  return PyString_FromString(t->allFramesAsDot(time.toSec()).c_str());
++  return PyBytes_FromString(t->allFramesAsDot(time.toSec()).c_str());
+ }
+ 
+ static PyObject *allFramesAsString(PyObject *self, PyObject *args)
+ {
+   tf::Transformer *t = ((transformer_t*)self)->t;
+-  return PyString_FromString(t->allFramesAsString().c_str());
++  return PyBytes_FromString(t->allFramesAsString().c_str());
+ }
+ 
+ static PyObject *canTransform(PyObject *self, PyObject *args, PyObject *kw)
+@@ -253,7 +252,7 @@ static PyObject *asListOfStrings(std::vector< std::string > los)
+   PyObject *r = PyList_New(los.size());
+   size_t i;
+   for (i = 0; i < los.size(); i++) {
+-    PyList_SetItem(r, i, PyString_FromString(los[i].c_str()));
++    PyList_SetItem(r, i, PyBytes_FromString(los[i].c_str()));
+   }
+   return r;
+ }
+@@ -400,8 +399,8 @@ static PyObject *setTransform(PyObject *self, PyObject *args)
+     return NULL;
+   tf::StampedTransform transform;
+   PyObject *header = PyObject_BorrowAttrString(py_transform, "header");
+-  transform.child_frame_id_ = PyString_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
+-  transform.frame_id_ = PyString_AsString(PyObject_BorrowAttrString(header, "frame_id"));
++  transform.child_frame_id_ = PyBytes_AsString(PyObject_BorrowAttrString(py_transform, "child_frame_id"));
++  transform.frame_id_ = PyBytes_AsString(PyObject_BorrowAttrString(header, "frame_id"));
+   if (rostime_converter(PyObject_BorrowAttrString(header, "stamp"), &transform.stamp_) != 1)
+     return NULL;
+ 
+@@ -475,7 +474,47 @@ static PyMethodDef module_methods[] = {
+   {NULL, NULL, NULL},
+ };
+ 
++
++#if PY_MAJOR_VERSION >= 3
++struct module_state {
++    PyObject *error;
++};
++
++#define GETSTATE(m) ((struct module_state*)PyModule_GetState(m))
++
++static int tf_traverse(PyObject *m, visitproc visit, void *arg) {
++    Py_VISIT(GETSTATE(m)->error);
++    return 0;
++}
++
++static int tf_clear(PyObject *m) {
++    Py_CLEAR(GETSTATE(m)->error);
++    return 0;
++}
++
++
++static struct PyModuleDef moduledef = {
++        PyModuleDef_HEAD_INIT,
++        "tf",
++        NULL,
++        sizeof(struct module_state),
++        transformer_methods,
++        NULL,
++        tf_traverse,
++        tf_clear,
++        NULL
++};
++
++#define INITERROR return NULL
++
++PyObject *
++PyInit_tf(void)
++
++#else
++#define INITERROR return
++
+ extern "C" void init_tf()
++#endif
+ {
+   PyObject *item, *m, *d;
+ 
+@@ -485,13 +524,13 @@ extern "C" void init_tf()
+   tf_lookupexception = PyErr_NewException((char*)"tf.LookupException", tf_exception, NULL);
+   tf_extrapolationexception = PyErr_NewException((char*)"tf.ExtrapolationException", tf_exception, NULL);
+ #else
+-  tf_exception = PyString_FromString("tf.error");
+-  tf_connectivityexception = PyString_FromString("tf.ConnectivityException");
+-  tf_lookupexception = PyString_FromString("tf.LookupException");
+-  tf_extrapolationexception = PyString_FromString("tf.ExtrapolationException");
++  tf_exception = PyBytes_FromString("tf.error");
++  tf_connectivityexception = PyBytes_FromString("tf.ConnectivityException");
++  tf_lookupexception = PyBytes_FromString("tf.LookupException");
++  tf_extrapolationexception = PyBytes_FromString("tf.ExtrapolationException");
+ #endif
+ 
+-  pModulerospy = PyImport_Import(item= PyString_FromString("rospy")); Py_DECREF(item);
++  pModulerospy = PyImport_Import(item= PyBytes_FromString("rospy")); Py_DECREF(item);
+ 
+   transformer_Type.tp_alloc = PyType_GenericAlloc;
+   transformer_Type.tp_new = PyType_GenericNew;
+@@ -499,13 +538,21 @@ extern "C" void init_tf()
+   transformer_Type.tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE;
+   transformer_Type.tp_methods = transformer_methods;
+   if (PyType_Ready(&transformer_Type) != 0)
+-    return;
++    INITERROR;
+ 
++#if PY_MAJOR_VERSION >= 3
++  m = PyModule_Create(&moduledef);
++#else
+   m = Py_InitModule("_tf", module_methods);
++#endif
+   PyModule_AddObject(m, "Transformer", (PyObject *)&transformer_Type);
+   d = PyModule_GetDict(m);
+   PyDict_SetItemString(d, "Exception", tf_exception);
+   PyDict_SetItemString(d, "ConnectivityException", tf_connectivityexception);
+   PyDict_SetItemString(d, "LookupException", tf_lookupexception);
+   PyDict_SetItemString(d, "ExtrapolationException", tf_extrapolationexception);
++
++#if PY_MAJOR_VERSION >= 3
++  return m;
++#endif
+ }
diff --git a/debian/patches/series b/debian/patches/series
index cd64645..bb21cc8 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 0001-Added-CMakeLists-to-build-thepackage.patch
 0002-Deleted-unneeded-dependency.patch
 0003-Add-Debian-specific-SONAME.patch
+0004-Python3-support.patch
diff --git a/debian/python-tf-conversions.pyinstall b/debian/python-tf-conversions.pyinstall
deleted file mode 100644
index cf0d9c4..0000000
--- a/debian/python-tf-conversions.pyinstall
+++ /dev/null
@@ -1 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf_conversions/*.py tf_conversions
diff --git a/debian/python-tf.pyinstall b/debian/python-tf.pyinstall
deleted file mode 100644
index c738cf4..0000000
--- a/debian/python-tf.pyinstall
+++ /dev/null
@@ -1,4 +0,0 @@
-debian/tmp/usr/lib/python2*/*/tf/*.py tf
-debian/tmp/usr/lib/python2*/*/tf/*.so tf
-debian/tmp/usr/lib/python2*/*/tf/msg/*.py tf.msg
-debian/tmp/usr/lib/python2*/*/tf/srv/*.py tf.srv
diff --git a/debian/python3-tf-conversions.install b/debian/python3-tf-conversions.install
new file mode 100644
index 0000000..e14f94a
--- /dev/null
+++ b/debian/python3-tf-conversions.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf_conversions
diff --git a/debian/python3-tf.install b/debian/python3-tf.install
new file mode 100644
index 0000000..7b9c09e
--- /dev/null
+++ b/debian/python3-tf.install
@@ -0,0 +1 @@
+usr/lib/python3*/*/tf
diff --git a/debian/rules b/debian/rules
index d5e4861..9c727a4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,28 +1,10 @@
 #!/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.git



More information about the debian-science-commits mailing list