qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject [54/89] [abbrv] qpid-proton git commit: PROTON-1794: Improve python module detection - Specifically detecting/running tox
Date Tue, 03 Jul 2018 22:13:43 GMT
PROTON-1794: Improve python module detection
- Specifically detecting/running tox

[reapplied as this was overwritten in the source tree reorg]


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

Branch: refs/heads/go1
Commit: e91457c7ed2bf7caee9414b19df54264fba71444
Parents: bdd986a
Author: Andrew Stitcher <astitcher@apache.org>
Authored: Mon Apr 9 13:41:56 2018 -0400
Committer: Andrew Stitcher <astitcher@apache.org>
Committed: Mon Apr 9 13:41:56 2018 -0400

----------------------------------------------------------------------
 CMakeLists.txt | 61 +++++++++++++++++++++++++++--------------------------
 1 file changed, 31 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/e91457c7/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 571fbee..4e05d48 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -378,39 +378,40 @@ if (BUILD_PYTHON)
               ${PYTHON_EXECUTABLE} -- ${python_coverage_options} "${py_root}/proton-test")
   set_tests_properties(python-test PROPERTIES PASS_REGULAR_EXPRESSION "Totals: .* 0 failed")
 
-  # Eventually, we'll get rid of this check when other
-  # platforms will be supported. Since `setup.py` will skip
-  # the build for non linux plaforms, it doesn't make sense
-  # to try to run them.
-  option(TOX_TEST "Enable muti-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"
)
-  if (NOT (TOX_ENVLIST STREQUAL tox_default))
-    message(WARNING "non-default TOX test set '${TOX_ENVLIST}' (default '${tox_default}')")
-  endif()
-  if (CMAKE_SYSTEM_NAME STREQUAL Linux AND TOX_TEST)
-    find_program(TOX_EXE "tox")
-    if (CMAKE_BUILD_TYPE MATCHES "Coverage")
-      message(STATUS "Building for coverage analysis; skipping the python-tox-tests")
-    elseif (TOX_EXE)
-      configure_file(
-        "${CMAKE_CURRENT_SOURCE_DIR}/misc/tox.ini.in"
-        "${CMAKE_CURRENT_BINARY_DIR}/tox.ini")
-      add_test (NAME python-tox-test
-                COMMAND ${PN_ENV_SCRIPT}
+  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"
)
+    mark_as_advanced(TOX_ENVLIST)
+
+    if (NOT (TOX_ENVLIST STREQUAL tox_default))
+      message(WARNING "non-default TOX test set '${TOX_ENVLIST}' (default '${tox_default}')")
+    endif()
+    if (ENABLE_TOX_TEST)
+      if (CMAKE_BUILD_TYPE MATCHES "Coverage")
+        message(STATUS "Building for coverage analysis; skipping the python-tox-tests")
+      else ()
+        configure_file(
+          "${CMAKE_CURRENT_SOURCE_DIR}/misc/tox.ini.in"
+          "${CMAKE_CURRENT_BINARY_DIR}/tox.ini")
+        add_test (NAME python-tox-test
+                  COMMAND ${PN_ENV_SCRIPT}
                   "PATH=${py_path}"
                   "SASLPASSWD=${SASLPASSWD_EXE}"
                   "SWIG=${SWIG_EXECUTABLE}"
-                  ${VALGRIND_ENV}
-                  ${TOX_EXE})
-      set_tests_properties(python-tox-test
-                           PROPERTIES
-                             PASS_REGULAR_EXPRESSION "Totals: .* ignored, 0 failed"
-                             FAIL_REGULAR_EXPRESSION "ERROR:[ ]+py[0-9]*: commands failed")
-    else (TOX_EXE)
-      message(STATUS "The tox tool is not available; skipping the python-tox-tests")
-    endif ()
-  endif (CMAKE_SYSTEM_NAME STREQUAL Linux AND TOX_TEST)
+                  ${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)
+  endif (NOT TOX_MODULE_FOUND)
 endif (BUILD_PYTHON)
 
 install (FILES LICENSE.txt README.md


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


Mime
View raw message