Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 24 additions & 9 deletions src/tools/python.jam
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ lib rt ;
# installed in the development system's default paths.
feature.feature pythonpath : : free optional path ;

# Declare python-numpy-include as a free feature accepting a path
feature.feature python-numpy-include : : free path ;

# The best configured version of Python 2 and 3.
py2-version = ;
py3-version = ;
Expand Down Expand Up @@ -900,21 +903,33 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? :
# Discover the presence of NumPy
#
debug-message "Checking for NumPy..." ;
local full-cmd = "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())" ;
local full-cmd = $(interpreter-cmd)" -c \"$(full-cmd)\"" ;
debug-message "running command '$(full-cmd)'" ;
local result = [ SHELL $(full-cmd) : strip-eol : exit-status ] ;
if $(result[2]) = 0

local custom-numpy = [ feature.get-values <python-numpy-include> : $(condition) ] ;

if $(custom-numpy)
{
.numpy = true ;
.numpy-include = $(result[1]) ;
.numpy-include = $(custom-numpy) ;
debug-message "NumPy enabled" ;
}
else
{
debug-message "NumPy disabled. Reason:" ;
debug-message " $(full-cmd) aborted with " ;
debug-message " $(result[1])" ;
local full-cmd = "import sys; sys.stderr = sys.stdout; import numpy; print(numpy.get_include())" ;
local full-cmd = $(interpreter-cmd)" -c \"$(full-cmd)\"" ;
debug-message "running command '$(full-cmd)'" ;
local result = [ SHELL $(full-cmd) : strip-eol : exit-status ] ;
if $(result[2]) = 0
{
.numpy = true ;
.numpy-include = $(result[1]) ;
debug-message "NumPy enabled" ;
}
else
{
debug-message "NumPy disabled. Reason:" ;
debug-message " $(full-cmd) aborted with " ;
debug-message " $(result[1])" ;
}
}

#
Expand Down