From 5a14905fd6d405c7e2091944a7398d1f70b807ea Mon Sep 17 00:00:00 2001 From: Vladimir Prus Date: Sun, 26 Feb 2006 16:17:20 +0000 Subject: [PATCH] Fix detection of Python on Darwin. Patch from Noel Belcourt. [SVN r33117] --- src/tools/python.jam | 35 ++++++++++++++++++++++++----------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/tools/python.jam b/src/tools/python.jam index 30e87ef5a..fbcf05d1f 100644 --- a/src/tools/python.jam +++ b/src/tools/python.jam @@ -140,7 +140,7 @@ rule init-unix ( version ? : root ? : includes ? : libraries ? ) # } } -rule init-mac ( version : root : includes ? : libraries ? ) +rule init-mac ( version : root ? : includes ? : libraries ? ) { if ! $(root) { @@ -153,16 +153,29 @@ rule init-mac ( version : root : includes ? : libraries ? ) root = /Library/Frameworks/Python.framework/Versions/$(version) ; } } - includes ?= $(PYTHON_ROOT)/include/python$(PYTHON_VERSION) ; - # FIXME: not sure what PYTHON_FRAMEWORK variable is - PYTHON_FRAMEWORK ?= $(root) ; - while $(PYTHON_FRAMEWORK:D=) && $(PYTHON_FRAMEWORK:D=) != Python.framework - { - PYTHON_FRAMEWORK = $(PYTHON_FRAMEWORK:D) ; - } - PYTHON_FRAMEWORK = $(PYTHON_FRAMEWORK:D)/Python ; - alias python + # includes ?= $(PYTHON_ROOT)/include/python$(PYTHON_VERSION) ; + includes ?= $(root)/include/python$(version) ; + libraries ?= $(root)/lib/python$(version)/config ; + + # Find the 'python' binary, which is used for testing. + # Look first in $(root)/bin, then in PATH. + local interpreter = [ common.get-invocation-command + python : python : : $(root)/bin : path-last ] ; + + # debug support + if --debug-configuration in [ modules.peek : ARGV ] + { + ECHO "notice: Python include path is" $(includes) ; + ECHO "notice: Python library path is" $(libraries) ; + ECHO "notice: Python interpreter is" $(interpreter) ; + } + + flags python.capture-output PYTHON : $(interpreter) ; + + PYTHON_FRAMEWORK ?= /System/Library/Frameworks/Python.framework ; + + alias python_for_extensions : : : @@ -171,7 +184,7 @@ rule init-mac ( version : root : includes ? : libraries ? ) alias python : - : MACOSXX darwin + : MACOSX darwin : : $(PYTHON_FRAMEWORK) ;