From 2c826c0f0f7b12b74c600a00f66b944543bcc67b Mon Sep 17 00:00:00 2001
From: Anthony Mallet <anthony.mallet@laas.fr>
Date: Mon, 22 Oct 2012 18:51:42 +0200
Subject: [PATCH] [wip/ros18-base] Define PYTHON_EXECUTABLE et al. in
 Makefile.common

Make sure to pass all variables defining the proper python version as found by
robotpkg, otherwise ros CMakeFiles may happily find python-3.2 and use it
instead of python<3, although this does not work in the end (at least ros-rx
does this and breaks on F17).

This is done in the common ros Makefile as this affects all packages.
---
 catkin/Makefile            |  3 ---
 py-rospkg/Makefile         |  9 ++++-----
 ros-actionlib/Makefile     |  1 -
 ros-comm/Makefile          |  1 -
 ros-common-msgs/Makefile   |  1 -
 ros-core/Makefile          |  1 -
 ros-gencpp/Makefile        |  1 -
 ros-genlisp/Makefile       |  1 -
 ros-genmsg/Makefile        |  1 -
 ros-genpy/Makefile         |  1 -
 ros-langs-dev/Makefile     |  1 -
 ros-langs/Makefile         |  1 -
 ros-rx/Makefile            |  1 -
 ros-std-msgs/Makefile      |  1 -
 ros18-base/Makefile.common | 11 +++++++++++
 rospack/Makefile           |  1 -
 16 files changed, 15 insertions(+), 21 deletions(-)

diff --git a/catkin/Makefile b/catkin/Makefile
index f5b24193..afb7131d 100644
--- a/catkin/Makefile
+++ b/catkin/Makefile
@@ -28,8 +28,6 @@ SUBST_CLASSES+=			bash-interp
 SUBST_FILES.bash-interp+=	bin/git-catkin
 SUBST_FILES.bash-interp+=	bin/git-catkin-track-all
 
-DEPEND_ABI.python=	python<3
-
 include ../../wip/py-rospkg/depend.mk
 include ../../mk/sysdep/bash.mk
 include ../../mk/sysdep/cmake.mk
@@ -39,5 +37,4 @@ include ../../mk/sysdep/py-argparse.mk
 include ../../mk/sysdep/py-empy.mk
 include ../../mk/sysdep/py-nose.mk
 include ../../mk/sysdep/py-yaml.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/py-rospkg/Makefile b/py-rospkg/Makefile
index 174af81d..c28c2272 100644
--- a/py-rospkg/Makefile
+++ b/py-rospkg/Makefile
@@ -14,17 +14,16 @@ HOMEPAGE=		http://ros.org/wiki/rospkg
 
 WRKSRC=			${WRKDIR}/ros-rospkg-${COMMIT}
 
-include ../../wip/ros18-base/Makefile.common
-
 USE_LANGUAGES=
 CONFLICTS+=		py[0-9][0-9]-rospkg-${VERSION}
 
+PYDISTUTILSPKG=		yes
+
+include ../../wip/ros18-base/Makefile.common
+
 SUBST_CLASSES+=		py-syspath py-interp
 SUBST_FILES.py-syspath+=scripts/rosversion
 SUBST_FILES.py-interp+=	scripts/rosversion
 
-PYDISTUTILSPKG=		yes
-DEPEND_ABI.python=	python<3
-
 include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-actionlib/Makefile b/ros-actionlib/Makefile
index 458fdee6..6b332957 100644
--- a/ros-actionlib/Makefile
+++ b/ros-actionlib/Makefile
@@ -19,5 +19,4 @@ include ../../wip/ros-genmsg/depend.mk
 include ../../wip/ros-langs/depend.mk
 include ../../wip/ros-core/depend.mk
 include ../../wip/ros-comm/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-comm/Makefile b/ros-comm/Makefile
index 7335efe9..edcbc6ca 100644
--- a/ros-comm/Makefile
+++ b/ros-comm/Makefile
@@ -28,5 +28,4 @@ include ../../wip/roscpp-core/depend.mk
 include ../../mk/sysdep/apr.mk
 include ../../mk/sysdep/py-paramiko.mk
 include ../../mk/sysdep/py-yaml.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-common-msgs/Makefile b/ros-common-msgs/Makefile
index 977c59d6..62732dc2 100644
--- a/ros-common-msgs/Makefile
+++ b/ros-common-msgs/Makefile
@@ -21,5 +21,4 @@ include ../../wip/catkin/depend.mk
 include ../../wip/ros-genmsg/depend.mk
 include ../../wip/ros-langs/depend.mk
 include ../../wip/ros-std-msgs/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-core/Makefile b/ros-core/Makefile
index 74476a2e..cc4870f5 100644
--- a/ros-core/Makefile
+++ b/ros-core/Makefile
@@ -22,6 +22,5 @@ include ../../devel/boost-libs/depend.mk
 include ../../wip/catkin/depend.mk
 include ../../wip/rospack/depend.mk
 include ../../wip/py-rospkg/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/sysdep/py-nose.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-gencpp/Makefile b/ros-gencpp/Makefile
index 718e630b..6193480e 100644
--- a/ros-gencpp/Makefile
+++ b/ros-gencpp/Makefile
@@ -15,5 +15,4 @@ SUBST_CLASSES+=		py-distsetup
 
 include ../../wip/catkin/depend.mk
 include ../../wip/ros-genmsg/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-genlisp/Makefile b/ros-genlisp/Makefile
index 77f7a9b9..8986d315 100644
--- a/ros-genlisp/Makefile
+++ b/ros-genlisp/Makefile
@@ -15,5 +15,4 @@ SUBST_CLASSES+=		py-distsetup
 
 include ../../wip/catkin/depend.mk
 include ../../wip/ros-genmsg/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-genmsg/Makefile b/ros-genmsg/Makefile
index aa4d1ff8..8426816b 100644
--- a/ros-genmsg/Makefile
+++ b/ros-genmsg/Makefile
@@ -12,5 +12,4 @@ HOMEPAGE=		http://www.ros.org/wiki/genmsg
 include ../../wip/ros18-base/Makefile.common
 
 include ../../wip/catkin/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-genpy/Makefile b/ros-genpy/Makefile
index 0f3411f3..a82aadfe 100644
--- a/ros-genpy/Makefile
+++ b/ros-genpy/Makefile
@@ -15,5 +15,4 @@ SUBST_CLASSES+=		py-distsetup
 
 include ../../wip/catkin/depend.mk
 include ../../wip/ros-genmsg/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-langs-dev/Makefile b/ros-langs-dev/Makefile
index b6d20846..fc5891e1 100644
--- a/ros-langs-dev/Makefile
+++ b/ros-langs-dev/Makefile
@@ -15,5 +15,4 @@ include ../../wip/catkin/depend.mk
 include ../../wip/ros-gencpp/depend.mk
 include ../../wip/ros-genpy/depend.mk
 include ../../wip/ros-genlisp/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-langs/Makefile b/ros-langs/Makefile
index 469c863d..065cc00a 100644
--- a/ros-langs/Makefile
+++ b/ros-langs/Makefile
@@ -14,5 +14,4 @@ include ../../wip/ros18-base/Makefile.common
 include ../../wip/catkin/depend.mk
 include ../../wip/roscpp-core/depend.mk
 include ../../wip/ros-langs-dev/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-rx/Makefile b/ros-rx/Makefile
index f27059ed..c8064aad 100644
--- a/ros-rx/Makefile
+++ b/ros-rx/Makefile
@@ -20,6 +20,5 @@ include ../../wip/rospack/depend.mk
 include ../../mk/sysdep/graphviz.mk
 include ../../mk/sysdep/py-matplotlib.mk
 include ../../mk/sysdep/py-wxpython.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/sysdep/wxwidgets.mk
 include ../../mk/robotpkg.mk
diff --git a/ros-std-msgs/Makefile b/ros-std-msgs/Makefile
index b9065be7..1d0d9e48 100644
--- a/ros-std-msgs/Makefile
+++ b/ros-std-msgs/Makefile
@@ -15,5 +15,4 @@ include ../../pkgtools/pkg-config/depend.mk
 include ../../wip/catkin/depend.mk
 include ../../wip/ros-genmsg/depend.mk
 include ../../wip/ros-langs/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/robotpkg.mk
diff --git a/ros18-base/Makefile.common b/ros18-base/Makefile.common
index a5c9f489..9b3f9801 100644
--- a/ros18-base/Makefile.common
+++ b/ros18-base/Makefile.common
@@ -23,6 +23,17 @@ WRKSRC?=	${WRKDIR}/${ROS_PKGURL}-${ROS_VERSION}
 USE_LANGUAGES?=	c c++
 
 
+# --- common dependencies --------------------------------------------------
+#
+CMAKE_ARGS+=	-DPYTHON_EXECUTABLE=${PYTHON}
+CMAKE_ARGS+=	-DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE}
+CMAKE_ARGS+=	-DPYTHON_LIBRARY=${PYTHON_LIB}
+
+DEPEND_ABI.python+=	python<3
+
+include ../../mk/sysdep/python.mk
+
+
 # --- replace interpreters -------------------------------------------------
 #
 # These targets can be enabled by defining SUBST_CLASSES and SUBST_FILES
diff --git a/rospack/Makefile b/rospack/Makefile
index 60e7c0f7..fbb6cba0 100644
--- a/rospack/Makefile
+++ b/rospack/Makefile
@@ -15,7 +15,6 @@ include ../../wip/ros18-base/Makefile.common
 include ../../devel/boost-headers/depend.mk
 include ../../devel/boost-libs/depend.mk
 include ../../wip/catkin/depend.mk
-include ../../mk/sysdep/python.mk
 include ../../mk/sysdep/py-nose.mk
 include ../../mk/sysdep/googletest.mk
 include ../../mk/robotpkg.mk
-- 
GitLab