You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2018/03/14 20:54:22 UTC

[1/2] qpid-proton git commit: PROTON-1794: Improve python module detection - Specifically detecting/running tox

Repository: qpid-proton
Updated Branches:
  refs/heads/master 241563b35 -> 04d466f36


PROTON-1794: Improve python module detection
- Specifically detecting/running tox


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/6018725a
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/6018725a
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/6018725a

Branch: refs/heads/master
Commit: 6018725aa0266df07b43ff434bba73cffd14fae7
Parents: 241563b
Author: Andrew Stitcher <as...@apache.org>
Authored: Wed Mar 14 15:30:14 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Mar 14 15:35:11 2018 -0400

----------------------------------------------------------------------
 proton-c/CMakeLists.txt                     | 18 ++++----
 tools/cmake/Modules/CheckPythonModule.cmake | 56 ++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6018725a/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index 192d766..381d533 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -19,6 +19,7 @@
 
 include(CheckLibraryExists)
 include(CheckSymbolExists)
+include(CheckPythonModule)
 
 include(versions.cmake)
 
@@ -765,10 +766,11 @@ if (BUILD_PYTHON)
               ${PYTHON_EXECUTABLE} -- ${python_coverage_options} "${py_root}/proton-test")
   set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
 
-  find_program(TOX_EXECUTABLE "tox")
-  mark_as_advanced(TOX_EXECUTABLE)
-  if (TOX_EXECUTABLE)
-    option(ENABLE_TOX_TEST "Enable muti-version python testing with TOX" ON)
+  check_python_module("tox" TOX_MODULE_FOUND)
+  if (NOT TOX_MODULE_FOUND)
+    message(STATUS "The tox tool is not available; skipping the python-tox-tests")
+  else ()
+    option(ENABLE_TOX_TEST "Enable multi-version python testing with TOX" ON)
 
     set(tox_default "py26,py27,py33,py34,py35,py36")
     set(TOX_ENVLIST ${tox_default} CACHE STRING "List of python environments for TOX tests" )
@@ -789,17 +791,15 @@ if (BUILD_PYTHON)
                   "PATH=${py_path}"
                   "SASLPASSWD=${SASLPASSWD_EXE}"
                   "SWIG=${SWIG_EXECUTABLE}"
-                  ${VALGRIND_ENV}
-                  ${TOX_EXECUTABLE})
+                  ${VALGRIND_ENV} --
+                  ${PYTHON_EXECUTABLE} -m tox)
         set_tests_properties(python-tox-test
                              PROPERTIES
                                PASS_REGULAR_EXPRESSION "Totals: .* ignored, 0 failed"
                                FAIL_REGULAR_EXPRESSION "ERROR:[ ]+py[0-9]*: commands failed")
       endif ()
     endif (ENABLE_TOX_TEST)
-  else (TOX_EXECUTABLE)
-    message(STATUS "The tox tool is not available; skipping the python-tox-tests")
-  endif(TOX_EXECUTABLE)
+  endif(NOT TOX_MODULE_FOUND)
 
   set (perf_pythonpath "${py_pythonpath}" "${CMAKE_SOURCE_DIR}/examples/cpp")
   to_native_path ("${perf_pythonpath}" perf_pythonpath)

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/6018725a/tools/cmake/Modules/CheckPythonModule.cmake
----------------------------------------------------------------------
diff --git a/tools/cmake/Modules/CheckPythonModule.cmake b/tools/cmake/Modules/CheckPythonModule.cmake
new file mode 100644
index 0000000..9e94ec3
--- /dev/null
+++ b/tools/cmake/Modules/CheckPythonModule.cmake
@@ -0,0 +1,56 @@
+#
+# 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.
+#
+
+#.rst
+# CheckPythonModule
+# ----------------
+#
+# Provides a macro to check if a python module is available
+#
+# .. commmand:: CHECK_PYTHON_MODULE
+#
+#   ::
+#
+#     CHECK_PYTHON_MODULE(<module> <variable>)
+#
+#   Check if the given python ``<module>`` may be used by the detected
+#   python interpreter and store the result in an internal cache entry
+#   named ``<variable>``.
+#
+#   The ``PYTHON_EXECUTABLE`` variable must be set before calling this
+#   macro, usually by using find_package(PythonInterp).
+
+macro (CHECK_PYTHON_MODULE MODULE VARIABLE)
+  if (NOT DEFINED "${VARIABLE}" AND DEFINED "PYTHON_EXECUTABLE")
+    execute_process(
+      COMMAND ${PYTHON_EXECUTABLE} -c "import sys, pkgutil; sys.exit(0 if pkgutil.find_loader('${MODULE}') else 1)"
+      RESULT_VARIABLE RESULT)
+    if (RESULT EQUAL 0)
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for Python module ${MODULE} - found")
+      endif()
+      set(${VARIABLE} 1 CACHE INTERNAL "Have Python module ${MODULE}")
+    else()
+      if(NOT CMAKE_REQUIRED_QUIET)
+        message(STATUS "Looking for Python module ${MODULE} - not found")
+      endif()
+      set(${VARIABLE} "" CACHE INTERNAL "Have Python module ${MODULE}")
+    endif()
+  endif()
+endmacro()


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


[2/2] qpid-proton git commit: PROTON-1787: Fix Travis CI MacOS Python mess - Based on original work by Roddie Kieley - Closes #139

Posted by as...@apache.org.
PROTON-1787: Fix Travis CI MacOS Python mess
- Based on original work by Roddie Kieley
- Closes #139


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/04d466f3
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/04d466f3
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/04d466f3

Branch: refs/heads/master
Commit: 04d466f36daaaf299f132e9f335ad276995894dd
Parents: 6018725
Author: Roddie Kieley <rk...@unifiedsoftworx.com>
Authored: Tue Mar 13 00:13:25 2018 -0400
Committer: Andrew Stitcher <as...@apache.org>
Committed: Wed Mar 14 16:50:45 2018 -0400

----------------------------------------------------------------------
 .travis.yml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/04d466f3/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 6d75c5e..568d100 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -36,20 +36,22 @@ matrix:
     osx_image: xcode7.3
     env:
     - PKG_CONFIG_PATH='/usr/local/opt/openssl/lib/pkgconfig'
+    - PATH="/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH"
     - QPID_PROTON_CMAKE_ARGS='-DPROACTOR=libuv -DSASL_IMPL=none -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DBUILD_PERL=OFF -DBUILD_RUBY=OFF'
     before_install:
     - brew update
-    - brew upgrade python openssl
+    - brew upgrade cmake python openssl
     - brew install libuv swig
 
   - os: osx
     osx_image: xcode9
     env:
     - PKG_CONFIG_PATH='/usr/local/opt/openssl/lib/pkgconfig'
+    - PATH="/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH"
     - QPID_PROTON_CMAKE_ARGS='-DPROACTOR=libuv -DSASL_IMPL=none -DCMAKE_OSX_DEPLOYMENT_TARGET=10.13 -DBUILD_PERL=OFF -DBUILD_RUBY=OFF'
     before_install:
     - brew update
-    - brew upgrade python openssl
+    - brew upgrade cmake python openssl
     - brew install libuv swig
 
 # Note addons is apt specific at the moment and will not be applied for osx.
@@ -72,8 +74,8 @@ addons:
     - lcov
 
 install:
-- pip2 install --user --upgrade pip
-- pip2 install --user coverage tox
+- python -m pip install --user --upgrade pip
+- python -m pip install --user coverage tox
 - gem install minitest
 
 before_script:


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