[PATCH] D69684: [debuginfo-tests] Don't look for Python 3 if we already have it

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 31 14:04:54 PDT 2019


rnk created this revision.
rnk added reviewers: aprantl, jmorse.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.

LLDB already requires Python 3 on Windows, so I already configure it
that way. For some reason CMake fails to find the one that Visual Studio
automatically installs at this standard location:

  C:/Program Files (x86)/Microsoft Visual Studio/Shared/Python37_64/python.exe

CMake prefers the python on path, which happens to be python 2.7.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D69684

Files:
  debuginfo-tests/CMakeLists.txt


Index: debuginfo-tests/CMakeLists.txt
===================================================================
--- debuginfo-tests/CMakeLists.txt
+++ debuginfo-tests/CMakeLists.txt
@@ -13,47 +13,50 @@
   not
   )
 
-# Wipe, uh, previous results
-unset(PYTHONINTERP_FOUND CACHE)
-unset(PYTHON_EXECUTABLE CACHE)
-unset(PYTHON_LIBRARY CACHE)
-unset(PYTHON_DLL CACHE)
-unset(PYTHON_INCLUDE_DIR CACHE)
-unset(PYTHON_VERSION_STRING CACHE)
-unset(PYTHON_VERSION_MAJOR CACHE)
-unset(PYTHON_VERSION_MINOR CACHE)
-unset(PYTHON_VERSION_PATCH CACHE)
-unset(PYTHONLIBS_VERSION_STRING CACHE)
+# Don't do anything if we already have Python 3.
+if (PYTHON_VERSION_MAJOR LESS 3)
+  # Wipe, uh, previous results
+  unset(PYTHONINTERP_FOUND CACHE)
+  unset(PYTHON_EXECUTABLE CACHE)
+  unset(PYTHON_LIBRARY CACHE)
+  unset(PYTHON_DLL CACHE)
+  unset(PYTHON_INCLUDE_DIR CACHE)
+  unset(PYTHON_VERSION_STRING CACHE)
+  unset(PYTHON_VERSION_MAJOR CACHE)
+  unset(PYTHON_VERSION_MINOR CACHE)
+  unset(PYTHON_VERSION_PATCH CACHE)
+  unset(PYTHONLIBS_VERSION_STRING CACHE)
 
-# Try to find python3. If it doesn't exist, dexter tests can't run.
-find_package(PythonInterp "3")
-if (NOT DEFINED PYTHON_EXECUTABLE)
-  message(FATAL_ERROR "Cannot run debuginfo-tests without python")
-elseif(PYTHON_VERSION_MAJOR LESS 3)
-  message(FATAL_ERROR "Cannot run debuginfo-tests without python 3")
-else()
-   configure_lit_site_cfg(
-    ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
-    ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
-    MAIN_CONFIG
-    ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
-    )
+  # Try to find python3. If it doesn't exist, dexter tests can't run.
+  find_package(PythonInterp "3")
+  if (NOT DEFINED PYTHON_EXECUTABLE)
+    message(FATAL_ERROR "Cannot run debuginfo-tests without python")
+  elseif(PYTHON_VERSION_MAJOR LESS 3)
+    message(FATAL_ERROR "Cannot run debuginfo-tests without python 3")
+  else()
+     configure_lit_site_cfg(
+      ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
+      ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
+      MAIN_CONFIG
+      ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
+      )
 
-  add_lit_testsuite(check-debuginfo "Running debug info integration tests"
-    ${CMAKE_CURRENT_BINARY_DIR}
-    DEPENDS ${DEBUGINFO_TEST_DEPS}
-    )
-  set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests") 
-endif()
+    add_lit_testsuite(check-debuginfo "Running debug info integration tests"
+      ${CMAKE_CURRENT_BINARY_DIR}
+      DEPENDS ${DEBUGINFO_TEST_DEPS}
+      )
+    set_target_properties(check-debuginfo PROPERTIES FOLDER "Debug info tests")
+  endif()
 
-# Prevent the rest of llvm observing our secret python3-ness
-unset(PYTHONINTERP_FOUND CACHE)
-unset(PYTHON_EXECUTABLE CACHE)
-unset(PYTHON_LIBRARY CACHE)
-unset(PYTHON_DLL CACHE)
-unset(PYTHON_INCLUDE_DIR CACHE)
-unset(PYTHON_VERSION_STRING CACHE)
-unset(PYTHON_VERSION_MAJOR CACHE)
-unset(PYTHON_VERSION_MINOR CACHE)
-unset(PYTHON_VERSION_PATCH CACHE)
-unset(PYTHONLIBS_VERSION_STRING CACHE)
+  # Prevent the rest of llvm observing our secret python3-ness
+  unset(PYTHONINTERP_FOUND CACHE)
+  unset(PYTHON_EXECUTABLE CACHE)
+  unset(PYTHON_LIBRARY CACHE)
+  unset(PYTHON_DLL CACHE)
+  unset(PYTHON_INCLUDE_DIR CACHE)
+  unset(PYTHON_VERSION_STRING CACHE)
+  unset(PYTHON_VERSION_MAJOR CACHE)
+  unset(PYTHON_VERSION_MINOR CACHE)
+  unset(PYTHON_VERSION_PATCH CACHE)
+  unset(PYTHONLIBS_VERSION_STRING CACHE)
+endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69684.227340.patch
Type: text/x-patch
Size: 3422 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191031/d1377ba2/attachment.bin>


More information about the llvm-commits mailing list