QPIDIT-94: Solving Python 2.x path discovery issue
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 69af53c..a18fc88 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,6 +21,11 @@
 
 cmake_minimum_required(VERSION 2.8.7 FATAL_ERROR)
 
+# Find Python 2.x install path
+
+execute_process(COMMAND ${CMAKE_SOURCE_DIR}/get-python-dir-name
+                OUTPUT_VARIABLE PYTHON_DIR_NAME)
+message(STATUS "Python install directory name: ${PYTHON_DIR_NAME}")
 
 # Find Proton components
 
@@ -51,16 +56,14 @@
 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 "execute_process(COMMAND python setup.py install --prefix ${CMAKE_INSTALL_PREFIX}
                               WORKING_DIRECTORY ../)")
 
 # TODO: THIS IS UGLY!
 # 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 chmod +x amqp_large_content_test.py
-                                               amqp_types_test.py
-                                               jms_hdrs_props_test.py
-                                               jms_messages_test.py
-                              WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/python2.7/site-packages/qpid_interop_test/)")
+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/)")
 
 configure_file(config.sh.in config.sh)
diff --git a/get-python-dir-name b/get-python-dir-name
new file mode 100755
index 0000000..e7515e6
--- /dev/null
+++ b/get-python-dir-name
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+#  Licensed to the Apache Software Foundation (ASF) under one or more
+#  contributor license agreements.  See the NOTICE file distributed with
+#  this work for additional information regarding copyright ownership.
+#  The ASF licenses this file to You under the Apache License, Version 2.0
+#  (the "License"); you may not use this file except in compliance with
+#  the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  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##*/}