From 7ce0854865ace48b15a6bb4b468d79bfa6e5b7bb Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 25 Oct 2007 23:19:48 +0000 Subject: [PATCH] Closes #1379. It would be good to have a much more principled approach; see comments in the diffs for details. [SVN r40468] --- v2/tools/python.jam | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/v2/tools/python.jam b/v2/tools/python.jam index 4ee755339..ef40bc560 100644 --- a/v2/tools/python.jam +++ b/v2/tools/python.jam @@ -901,6 +901,27 @@ local rule configure ( else { declare-libpython-target $(version) : $(target-requirements) ; + + # This is an evil hack. On, Windows, when Python is embedded, + # nothing seems to set up sys.path to include Python's + # standard library + # (http://article.gmane.org/gmane.comp.python.general/544986). The + # evil here, aside from the workaround necessitated by + # Python's bug, is that: + # + # a. we're guessing the location of the python standard + # library from the location of pythonXX.lib + # + # b. we're hijacking the property to get + # the environment variable set up, and the user may want to + # use it for something else (e.g. launch the debugger). + local set-PYTHONPATH ; + if $(target-os) = windows + { + set-PYTHONPATH = + [ common.prepend-path-variable-command PYTHONPATH : $(libraries:D)/Lib ] ; + } + alias python : : $(target-requirements) @@ -909,7 +930,9 @@ local rule configure ( # the system libs is a mystery, but if we don't do it, on # cygwin, -lpythonX.Y never appears in the command line # (although it does on linux). - : $(usage-requirements) $(libraries) $(dll-path) python.lib + : $(usage-requirements) + $(set-PYTHONPATH) + $(libraries) $(dll-path) python.lib ; }