From a2eb89417fbb6d61526b1819cbe3d0a60537eedd Mon Sep 17 00:00:00 2001
From: Doug Hellmann <doug@doughellmann.com>
Date: Mon, 9 Jan 2017 22:11:49 +0000
Subject: [PATCH] install LIBS_FROM_GIT using python 2 and 3 where appropriate

When installing a library from source and python 3 is enabled, first run
the installation process with python 2 enabled to ensure the library is
also installed under python 2 for any services not yet running under
3. The python 3 version is installed second so that command line tools
installed with libraries are installed under python 3 when python 3 is
enabled.

Change-Id: Ibb0f7a68d21081bf7652a0c1515080c0c54888ca
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
---
 inc/python | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/inc/python b/inc/python
index 1c581ba22b..086056350f 100644
--- a/inc/python
+++ b/inc/python
@@ -399,6 +399,16 @@ function setup_lib {
 function setup_dev_lib {
     local name=$1
     local dir=${GITDIR[$name]}
+    if python3_enabled; then
+        # Turn off Python 3 mode and install the package again,
+        # forcing a Python 2 installation. This ensures that all libs
+        # being used for development are installed under both versions
+        # of Python.
+        echo "Installing $name again without Python 3 enabled"
+        USE_PYTHON3=False
+        setup_develop $dir
+        USE_PYTHON3=True
+    fi
     setup_develop $dir
 }