qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kp...@apache.org
Subject qpid-interop-test git commit: QPIDIT-135: Added check for Python3 availability, disable Python3 shims when not present
Date Fri, 03 Aug 2018 16:01:24 GMT
Repository: qpid-interop-test
Updated Branches:
  refs/heads/master 50076724a -> d2eea54c6


QPIDIT-135: Added check for Python3 availability, disable Python3 shims when not present


Project: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/commit/d2eea54c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/tree/d2eea54c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-interop-test/diff/d2eea54c

Branch: refs/heads/master
Commit: d2eea54c62fba703577422fc78c6efbdf5efd0c0
Parents: 5007672
Author: Kim van der Riet <kpvdr@apache.org>
Authored: Fri Aug 3 12:00:57 2018 -0400
Committer: Kim van der Riet <kpvdr@apache.org>
Committed: Fri Aug 3 12:00:57 2018 -0400

----------------------------------------------------------------------
 CMakeLists.txt                             | 13 ++++++++-----
 config.sh.in                               | 11 ++++++++---
 get-python-dir-name                        | 14 ++++++++++++--
 src/python/qpid_interop_test/qit_common.py |  8 ++++++--
 4 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/d2eea54c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9e3c33b..790d7d7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -36,9 +36,12 @@ endif ()
 # Find Python 2.7.x install path
 
 find_package( PythonInterp 2.7 REQUIRED )
-execute_process(COMMAND ${CMAKE_SOURCE_DIR}/get-python-dir-name
-                OUTPUT_VARIABLE PYTHON_DIR_NAME)
-message(STATUS "Python install directory name: ${PYTHON_DIR_NAME}")
+execute_process(COMMAND ${CMAKE_SOURCE_DIR}/get-python-dir-name 2
+                OUTPUT_VARIABLE PYTHON2_DIR_NAME)
+message(STATUS "Python 2 install directory name: ${PYTHON2_DIR_NAME}")
+execute_process(COMMAND ${CMAKE_SOURCE_DIR}/get-python-dir-name 3
+                OUTPUT_VARIABLE PYTHON3_DIR_NAME)
+message(STATUS "Python 3 install directory name: ${PYTHON3_DIR_NAME}")
 
 # Find Java
 
@@ -126,7 +129,7 @@ add_subdirectory(shims/rhea-js)
 add_subdirectory(docs)
 
 # Install files using python setup.py
-install(CODE "MESSAGE(STATUS \"Python install dir: ${CMAKE_INSTALL_PREFIX}/lib/${PYTHON_DIR_NAME}/site-packages/qpid_interop_test/\")")
+install(CODE "MESSAGE(STATUS \"Python install dir: ${CMAKE_INSTALL_PREFIX}/lib/${PYTHON2_DIR_NAME}/site-packages/qpid_interop_test/\")")
 install(CODE "execute_process(COMMAND python setup.py install --prefix ${CMAKE_INSTALL_PREFIX}
                               WORKING_DIRECTORY ../)")
 
@@ -134,6 +137,6 @@ install(CODE "execute_process(COMMAND python setup.py install --prefix
${CMAKE_I
 # Find a way to handle this as part of the Python install process instead
 # Set the following Python scripts to executable:
 install(CODE "execute_process(COMMAND bash -c \"chmod +x *_test.py\"
-                              WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/${PYTHON_DIR_NAME}/site-packages/qpid_interop_test/)")
+                              WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/${PYTHON2_DIR_NAME}/site-packages/qpid_interop_test/)")
 
 configure_file(config.sh.in config.sh)

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/d2eea54c/config.sh.in
----------------------------------------------------------------------
diff --git a/config.sh.in b/config.sh.in
index dff4634..f7bd3c2 100644
--- a/config.sh.in
+++ b/config.sh.in
@@ -19,8 +19,13 @@
 export QPID_INTEROP_TEST_HOME=@CMAKE_SOURCE_DIR@
 export QIT_INSTALL_PREFIX=@CMAKE_INSTALL_PREFIX@
 CURRENT_PYTHONPATH=$PYTHONPATH
-export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/lib64/proton/bindings/python:@CMAKE_INSTALL_PREFIX@/lib/@PYTHON_DIR_NAME@/site-packages:@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python:$CURRENT_PYTHONPATH
-CURRENT_PYTHON3PATH=$PYTHON3PATH
-export PYTHON3PATH=@CMAKE_INSTALL_PREFIX@/lib64/proton/bindings/python3:@CMAKE_INSTALL_PREFIX@/lib/@PYTHON_DIR_NAME@/site-packages:@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python:$CURRENT_PYTHON3PATH
+export PYTHONPATH=@CMAKE_INSTALL_PREFIX@/lib64/proton/bindings/python:@CMAKE_INSTALL_PREFIX@/lib/@PYTHON2_DIR_NAME@/site-packages:@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python:$CURRENT_PYTHONPATH
+if [[ "@PYTHON3_DIR_NAME@" == "NOT_FOUND" ]]; then
+    unset PYTHON3PATH
+    echo "No Python 3.x found, Python 3 shims disabled"
+else
+    CURRENT_PYTHON3PATH=$PYTHON3PATH
+    export PYTHON3PATH=@CMAKE_INSTALL_PREFIX@/lib64/proton/bindings/python3:@CMAKE_INSTALL_PREFIX@/lib/@PYTHON3_DIR_NAME@/site-packages:@CMAKE_INSTALL_PREFIX@/libexec/qpid_interop_test/shims/qpid-proton-python:$CURRENT_PYTHON3PATH
+fi
 export LD_LIBRARY_PATH=@CMAKE_INSTALL_PREFIX@/lib64:$LD_LIBRARY_PATH
 export PATH=@CMAKE_INSTALL_PREFIX@/lib/@PYTHON_DIR_NAME@/site-packages/qpid_interop_test:$PATH

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/d2eea54c/get-python-dir-name
----------------------------------------------------------------------
diff --git a/get-python-dir-name b/get-python-dir-name
index e7515e6..8d971d8 100755
--- a/get-python-dir-name
+++ b/get-python-dir-name
@@ -15,5 +15,15 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License.
 
-PYTHON_DIR=`ls -d /usr/lib/python2*`
-echo -n ${PYTHON_DIR##*/}
+# $1: Python major version, either 2 or 3
+
+if [[ $# != 1 ]]; then
+    echo "Python major ver required as parameter"
+    exit 1
+fi
+PYTHON_DIR=`ls -d /usr/lib/python${1}* 2> /dev/null`
+if [[ $? == 0 ]]; then
+    echo -n ${PYTHON_DIR##*/}
+else
+    echo -n "NOT_FOUND"
+fi

http://git-wip-us.apache.org/repos/asf/qpid-interop-test/blob/d2eea54c/src/python/qpid_interop_test/qit_common.py
----------------------------------------------------------------------
diff --git a/src/python/qpid_interop_test/qit_common.py b/src/python/qpid_interop_test/qit_common.py
index 94f5fcc..f79ad48 100644
--- a/src/python/qpid_interop_test/qit_common.py
+++ b/src/python/qpid_interop_test/qit_common.py
@@ -37,6 +37,7 @@ QIT_INSTALL_PREFIX = getenv('QIT_INSTALL_PREFIX')
 if QIT_INSTALL_PREFIX is None:
     print('ERROR: Environment variable QIT_INSTALL_PREFIX is not set')
     sys.exit(1)
+QIT_ENABLE_PYTHON3_SHIM = getenv('PYTHON3PATH') is not None
 QIT_TEST_SHIM_HOME = path.join(QIT_INSTALL_PREFIX, 'libexec', 'qpid_interop_test', 'shims')
 
 QPID_JMS_SHIM_VER = '0.3.0-SNAPSHOT'
@@ -320,9 +321,12 @@ class QitTest(object):
                          qpid_interop_test.qit_shim.ProtonCppShim(proton_cpp_snd_shim, proton_cpp_rcv_shim),
                          qpid_interop_test.qit_shim.ProtonPython2Shim.NAME: \
                          qpid_interop_test.qit_shim.ProtonPython2Shim(proton_python_snd_shim,
proton_python_rcv_shim),
-                         qpid_interop_test.qit_shim.ProtonPython3Shim.NAME: \
-                         qpid_interop_test.qit_shim.ProtonPython3Shim(proton_python_snd_shim,
proton_python_rcv_shim),
+#                         qpid_interop_test.qit_shim.ProtonPython3Shim.NAME: \
+#                         qpid_interop_test.qit_shim.ProtonPython3Shim(proton_python_snd_shim,
proton_python_rcv_shim),
                         }
+        if QIT_ENABLE_PYTHON3_SHIM:
+            self.shim_map[qpid_interop_test.qit_shim.ProtonPython3Shim.NAME] = \
+                qpid_interop_test.qit_shim.ProtonPython3Shim(proton_python_snd_shim, proton_python_rcv_shim)
 
         # Add shims that need detection during installation only if the necessary bits are
present
         # Rhea Javascript client


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message