enable python3 compatible builds of ROS (resolves #458)

By default meta-ros uses python2. In case you want to get
python3-compatible builds add the following line to your local.conf:

    ROS_USE_PYTHON3 = "yes"

Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
This commit is contained in:
Dmitry Rozhkov 2017-04-07 14:54:49 +03:00
parent 38f722a81b
commit 3e201940f6
28 changed files with 65 additions and 35 deletions

View File

@ -2,7 +2,9 @@
# Copyright (c) 2013 Stefan Herbrechtsmeier, Bielefeld University
#
inherit cmake distutils-base ros faulty-solibs
ROS_USE_PYTHON3 ??= "no"
inherit cmake ${@'distutils3-base' if bb.utils.to_boolean(d.getVar('ROS_USE_PYTHON3', True)) else 'distutils-base'} ros faulty-solibs
DEPENDS_prepend = "${@'' if (d.getVar('BPN', True) == 'catkin') or (d.getVar('BPN', True) == 'catkin-runtime') else 'catkin-native '}"

View File

@ -11,8 +11,8 @@ FILES_${PN} = "${PYTHON_SITEPACKAGES_DIR} ${ros_bindir}/catkin_find"
RDEPENDS_${PN}_class-native = ""
RDEPENDS_${PN} = "\
python-catkin-pkg python-argparse python-misc python-multiprocessing \
python-shell python-subprocess python-xml python-pkgutil"
${PYTHON_PN}-catkin-pkg ${PYTHON_PN}-argparse ${PYTHON_PN}-misc ${PYTHON_PN}-multiprocessing \
${PYTHON_PN}-shell ${PYTHON_PN}-subprocess ${PYTHON_PN}-xml ${PYTHON_PN}-pkgutil"
# Delete everything but the python packages in order to avoid
# that the QA error [installed-vs-shipped] hits on us.

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cmake python-empy-native python-catkin-pkg-native"
DEPENDS = "cmake ${PYTHON_PN}-empy-native ${PYTHON_PN}-catkin-pkg-native"
SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "d58460cc9112812d8c4e6ecf98bbcc85"
@ -14,6 +14,7 @@ SRC_URI += "\
file://0001-use-python-provided-by-environment-instead-of-the-ge.patch \
file://0001-avoid-using-host-s-paths-when-cross-compiling.patch \
file://0001-relocate-dependency-s-headers-to-current-sysroot.patch \
${@'file://0001-python.cmake-look-for-python3-first.patch' if d.getVar('PYTHON_PN', True) == 'python3' else ''} \
"
inherit catkin

View File

@ -2,7 +2,7 @@ require catkin.inc
DEPENDS_class-native += "catkin-runtime"
RDEPENDS_${PN}_class-native = "python-catkin-pkg"
RDEPENDS_${PN}_class-native = "${PYTHON_PN}-catkin-pkg"
RDEPENDS_${PN} = "cmake make binutils binutils-symlinks gcc gcc-symlinks g++ g++-symlinks \
catkin-runtime"
@ -14,7 +14,7 @@ RDEPENDS_${PN} = "cmake make binutils binutils-symlinks gcc gcc-symlinks g++ g++
do_install_append() {
rm ${D}${ros_bindir}/catkin_find
rm -rf ${D}${PYTHON_SITEPACKAGES_DIR}
rmdir ${D}${ros_libdir}/python2.7
rmdir ${D}${ros_libdir}/${PYTHON_DIR}
}
BBCLASSEXTEND += "native"

View File

@ -0,0 +1,27 @@
From 224186a1af40cd3b7efb4f0648a3a4ca6ca1e7fa Mon Sep 17 00:00:00 2001
From: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
Date: Thu, 6 Apr 2017 15:25:13 +0300
Subject: [PATCH] python.cmake: look for python3 first
Upstream-Status: Inappropriate [the patch overrides ROS's default to python2]
Signed-off-by: Dmitry Rozhkov <dmitry.rozhkov@linux.intel.com>
---
cmake/python.cmake | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmake/python.cmake b/cmake/python.cmake
index 70f3d26..38f8320 100644
--- a/cmake/python.cmake
+++ b/cmake/python.cmake
@@ -5,6 +5,7 @@ if(PYTHON_VERSION)
set(PythonInterp_FIND_VERSION "${PYTHON_VERSION}")
endif()
+set(Python_ADDITIONAL_VERSIONS "3")
find_package(PythonInterp REQUIRED)
message(STATUS "Using PYTHON_EXECUTABLE: ${PYTHON_EXECUTABLE}")
--
2.9.3

View File

@ -4,7 +4,7 @@ LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "rosconsole tf roscpp angles message-generation dynamic-reconfigure libtinyxml \
realtime-tools message-filters python-rospkg"
realtime-tools message-filters ${PYTHON_PN}-rospkg"
SRC_URI = "https://github.com/ros-controls/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "40bc1f04e5936b7fee824f6717702a62"

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=7;endline=7;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "roscpp sensor-msgs nodelet image-transport image-geometry dynamic-reconfigure python-rospkg"
DEPENDS = "roscpp sensor-msgs nodelet image-transport image-geometry dynamic-reconfigure ${PYTHON_PN}-rospkg"
SRC_URI = "https://github.com/ros-perception/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz \
file://0001-Add-missing-std-namespace-prefixes.patch \

View File

@ -9,5 +9,5 @@ SRC_URI[sha256sum] = "d7627a2df169e4e8208347d9215e47c723a015b67ef3ed8cda8b61b6cf
inherit catkin
RDEPENDS_${PN} = "python-stringold python-pprint"
RDEPENDS_${PN} = "${PYTHON_PN}-stringold ${PYTHON_PN}-pprint"
RDEPENDS_${PN}_class-native = ""

View File

@ -11,5 +11,5 @@ SRC_URI[sha256sum] = "e4465daffb352b4b45180a6157925b16ab3042996984ad231531134e4d
inherit catkin
RDEPENDS_${PN} = "python-math genmsg python-shell"
RDEPENDS_${PN} = "${PYTHON_PN}-math genmsg ${PYTHON_PN}-shell"
RDEPENDS_${PN}_class-native = ""

View File

@ -9,4 +9,4 @@ require geometry.inc
SRC_URI += "file://0001-Fix-stdlib.h-No-such-file-or-directory-errors-in-GCC.patch;striplevel=2"
RDEPENDS_${PN} = "python-numpy"
RDEPENDS_${PN} = "${PYTHON_PN}-numpy"

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "boost camera-calibration-parsers cv-bridge dynamic-reconfigure image-geometry image-transport nodelet opencv roscpp sensor-msgs python-rospkg"
DEPENDS = "boost camera-calibration-parsers cv-bridge dynamic-reconfigure image-geometry image-transport nodelet opencv roscpp sensor-msgs ${PYTHON_PN}-rospkg"
require image-pipeline.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=12;endline=12;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "camera-info-manager cv-bridge dynamic-reconfigure image-transport nodelet roscpp sensor-msgs python-rospkg"
DEPENDS = "camera-info-manager cv-bridge dynamic-reconfigure image-transport nodelet roscpp sensor-msgs ${PYTHON_PN}-rospkg"
require image-pipeline.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=26;endline=26;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cmake-modules cv-bridge dynamic-reconfigure eigen-conversions image-transport nodelet opencv roscpp tf2 tf2-geometry-msgs tf2-ros python-rospkg"
DEPENDS = "cmake-modules cv-bridge dynamic-reconfigure eigen-conversions image-transport nodelet opencv roscpp tf2 tf2-geometry-msgs tf2-ros ${PYTHON_PN}-rospkg"
require image-pipeline.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf python-rospkg"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf ${PYTHON_PN}-rospkg"
require image-transport-plugins.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf python-rospkg"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf ${PYTHON_PN}-rospkg"
require image-transport-plugins.inc

View File

@ -4,6 +4,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=9;endline=9;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf rosbag python-rospkg"
DEPENDS = "cv-bridge dynamic-reconfigure image-transport tf rosbag ${PYTHON_PN}-rospkg"
require image-transport-plugins.inc

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=13;endline=13;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "moveit-core moveit-ros-perception dynamic-reconfigure python-rospkg libtinyxml"
DEPENDS = "moveit-core moveit-ros-perception dynamic-reconfigure ${PYTHON_PN}-rospkg libtinyxml"
require moveit-${PV}.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "LGPL-2.1+"
LIC_FILES_CHKSUM = "file://package.xml;beginline=21;endline=21;md5=58d727014cda5ed405b7fb52666a1f97"
DEPENDS = "dynamic-reconfigure message-filters nav-msgs rosbag roscpp std-srvs tf python-rospkg"
DEPENDS = "dynamic-reconfigure message-filters nav-msgs rosbag roscpp std-srvs tf ${PYTHON_PN}-rospkg"
require navigation.inc

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=8;endline=8;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "dynamic-reconfigure python-rospkg"
DEPENDS = "dynamic-reconfigure ${PYTHON_PN}-rospkg"
require nodelet-core.inc

View File

@ -7,7 +7,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=15;endline=15;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "dynamic-reconfigure python-rospkg"
DEPENDS = "dynamic-reconfigure ${PYTHON_PN}-rospkg"
SRC_URI = "https://github.com/KristofRobot/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "4712cbe1d9d8bacd9eebfd51825ada36"
@ -17,4 +17,4 @@ S = "${WORKDIR}/${ROS_SP}"
inherit catkin
RDEPENDS_${PN} = "rospy tf sensor-msgs python-pyserial"
RDEPENDS_${PN} = "rospy tf sensor-msgs ${PYTHON_PN}-pyserial"

View File

@ -4,7 +4,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=10;endline=10;md5=d566ef916e9dedc494f5f793a6690ba5"
RDEPENDS_${PN} = "python-xmlrpc python-threading python-rospkg rospy python-netifaces"
RDEPENDS_${PN} = "${PYTHON_PN}-xmlrpc ${PYTHON_PN}-threading ${PYTHON_PN}-rospkg rospy ${PYTHON_PN}-netifaces"
require ros-comm.inc

View File

@ -16,12 +16,12 @@ SRC_URI += "file://0001-increase-rosmaster-timeout.patch \
ROS_PKG_SUBDIR = "tools"
RDEPENDS_${PN} = "\
python-textutils \
python-logging \
python-threading \
python-rospkg \
${PYTHON_PN}-textutils \
${PYTHON_PN}-logging \
${PYTHON_PN}-threading \
${PYTHON_PN}-rospkg \
rosgraph \
python-pyyaml \
${PYTHON_PN}-pyyaml \
roslib \
rosclean \
rosmaster \

View File

@ -4,7 +4,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=23;endline=23;md5=d566ef916e9dedc494f5f793a6690ba5"
RDEPENDS_${PN} = "std-msgs genpy python-logging python-pyyaml rosgraph roslib rosgraph-msgs roscpp"
RDEPENDS_${PN} = "std-msgs genpy ${PYTHON_PN}-logging ${PYTHON_PN}-pyyaml rosgraph roslib rosgraph-msgs roscpp"
require ros-comm.inc

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=8;endline=8;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "boost python-nose"
DEPENDS = "boost ${PYTHON_PN}-nose"
DEPENDS_class-native = "boost-native rosunit-native"
require ros-comm.inc

View File

@ -9,4 +9,4 @@ require ros.inc
ROS_PKG_SUBDIR = "core"
RDEPENDS_${PN} = "python-rospkg catkin-runtime"
RDEPENDS_${PN} = "${PYTHON_PN}-rospkg catkin-runtime"

View File

@ -3,7 +3,7 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=6;endline=6;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "boost cmake-modules python-rospkg-native libtinyxml"
DEPENDS = "boost cmake-modules ${PYTHON_PN}-rospkg-native libtinyxml"
SRC_URI = "https://github.com/ros/${ROS_SPN}/archive/${PV}.tar.gz;downloadfilename=${ROS_SP}.tar.gz"
SRC_URI[md5sum] = "f415d53b620d35ce674959ac7616d202"
@ -11,4 +11,4 @@ SRC_URI[sha256sum] = "a8fecbe03f9757510fe47137642e39a7c31b823d5bf7fa7890acc11691
inherit catkin
RDEPENDS_${PN} = "python-rosdep python-subprocess"
RDEPENDS_${PN} = "${PYTHON_PN}-rosdep ${PYTHON_PN}-subprocess"

View File

@ -11,4 +11,4 @@ S = "${WORKDIR}/${ROS_SP}/urdf_parser_py"
inherit catkin
RDEPENDS_${PN} = "python-lxml"
RDEPENDS_${PN} = "${PYTHON_PN}-lxml"

View File

@ -3,6 +3,6 @@ SECTION = "devel"
LICENSE = "BSD"
LIC_FILES_CHKSUM = "file://package.xml;beginline=11;endline=11;md5=d566ef916e9dedc494f5f793a6690ba5"
DEPENDS = "boost opencv rosconsole sensor-msgs python-numpy-native"
DEPENDS = "boost opencv rosconsole sensor-msgs ${PYTHON_PN}-numpy-native"
require vision-opencv.inc