Ensure we use the first Python on PATH

This commit is contained in:
Antoine Pitrou committed 2020-03-02 12:02:45 +01:00
1 parent 7395f83af5
commit b3c01ebe1d
5 files changed
+16 -5

No files matched your search

+5
View File
@@ -140,6 +140,11 @@ include(DefineOptions)
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
find_package(PythonInterp)
else()
# Use the first Python installation on PATH, not the newest one
set(Python3_FIND_STRATEGY "LOCATION")
# On Windows, use registry last, not first
set(Python3_FIND_REGISTRY "LAST")
find_package(Python3)
set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
endif()
+2 -2
View File
@@ -38,7 +38,7 @@
#
#============================================================================
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0")
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.15.0")
# FindPython3Alt.cmake also looks for NumPy, use it.
if(NumPy_FIND_REQUIRED)
find_package(Python3Alt REQUIRED)
@@ -50,7 +50,7 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.14.0")
return()
endif()
# Legacy code below (CMake < 3.14.0)
# Legacy code below (CMake < 3.15.0)
# Finding NumPy involves calling the Python interpreter
if(NumPy_FIND_REQUIRED)
+2 -1
View File
@@ -22,7 +22,8 @@
# - PYTHON_LIBRARIES
# - PYTHON_OTHER_LIBS
if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
# Need CMake 3.15 or later for Python3_FIND_STRATEGY
if(${CMAKE_VERSION} VERSION_LESS "3.15.0")
# Use deprecated FindPythonInterp package
if(Python3Alt_FIND_REQUIRED)
find_package(PythonLibsNew REQUIRED)
+1 -1
View File
@@ -57,7 +57,7 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# Legacy code for CMake < 3.14.0. The primary point of entry should be
# Legacy code for CMake < 3.15.0. The primary point of entry should be
# FindPython3Alt.cmake.
# Use the Python interpreter to find the libs.
+6 -1
View File
@@ -18,7 +18,7 @@
# Includes code assembled from BSD/MIT/Apache-licensed code from some 3rd-party
# projects, including Kudu, Impala, and libdynd. See python/LICENSE.txt
cmake_minimum_required(VERSION 2.7)
cmake_minimum_required(VERSION 3.2)
project(pyarrow)
# Running from a Python sdist tarball
@@ -41,6 +41,11 @@ if(POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
# Use the first Python installation on PATH, not the newest one
set(Python3_FIND_STRATEGY "LOCATION")
# On Windows, use registry last, not first
set(Python3_FIND_REGISTRY "LAST")
# Allow "make install" to not depend on all targets.
#
# Must be declared in the top-level CMakeLists.txt.