Update of /cvsroot/boost/boost/tools/build/v2/tools
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv15092

Modified Files:
      Tag: RC_1_34_0
        python.jam 
Log Message:
factor out the search through Wow6432node in the registry of software

Make path-to-native work on zero or more paths, which simplifies lots
of code.

Factor native path translation out of compute-default-paths and into its caller.

Remove the path-to-native translation on the prefix from
candidate-interpreters, as the passed prefix has to be native anyway.

Fix the capturing of the exec_prefix for use in setting dll-path for
windows targets.


Index: python.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/tools/python.jam,v
retrieving revision 1.12.2.42
retrieving revision 1.12.2.43
diff -u -d -r1.12.2.42 -r1.12.2.43
--- python.jam  21 Mar 2007 08:02:27 -0000      1.12.2.42
+++ python.jam  21 Mar 2007 17:44:24 -0000      1.12.2.43
@@ -213,18 +213,24 @@
     }
 }
 
-# Like W32_GETREG, except prepend HKEY_CURRENT_USER and
-# HKEY_LOCAL_MACHINE to the argument, returning the first result
-# found.
-local rule registry-value ( path : data ? )
+# Like W32_GETREG, except prepend HKEY_CURRENT_USER\SOFTWARE and
+# HKEY_LOCAL_MACHINE\SOFTWARE to the first argument, returning the
+# first result found.  Also accounts for the fact that on 64-bit
+# machines, 32-bit software has its own area, under
+# SOFTWARE\Wow6432node.
+local rule software-registry-value ( path : data ? )
 {
     local result ;
     for local root in HKEY_CURRENT_USER HKEY_LOCAL_MACHINE
     {
-        if ! $(result)
+        for local x64elt in "" Wow6432node\\ # Account for 64-bit windows
         {
-            result = [ W32_GETREG $(root)"\\"$(path) : $(data) ] ;
+            if ! $(result)
+            {
+                result = [ W32_GETREG $(root)\\SOFTWARE\\$(x64elt)$(path) : 
$(data) ] ;
+            }
         }
+        
     }
     return $(result) ;
 }
@@ -269,7 +275,7 @@
         while $(head)
         {
             local root = [ 
-              registry-value "SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts 
v2\\"$(head) 
+              software-registry-value "Cygnus Solutions\\Cygwin\\mounts 
v2\\"$(head) 
                 : native 
             ] ;
             
@@ -323,16 +329,22 @@
     return [ SUBST $(path) ($(.windows-drive-letter-re)|.*([\\]).*) $1 ] ;
 }
 
-local rule path-to-native ( path )
+local rule path-to-native ( paths * )
 {
-    if [ guess-windows-path $(path) ]
-    {
-        return [ windows-path-to-native $(path) ] ;
-    }
-    else
+    local result ;
+    
+    for local p in $(paths)
     {
-        return [ *nix-path-to-native $(path:T) ] ;
+        if [ guess-windows-path $(p) ]
+        {
+            result += [ windows-path-to-native $(p) ] ;
+        }
+        else
+        {
+            result += [ *nix-path-to-native $(p:T) ] ;
+        }
     }
+    return $(result) ;
 }
 
 # Validate the version string and extract the major/minor part we care
@@ -368,19 +380,16 @@
     
     for local v in $(version)
     {
-        for local x64elt in "" Wow6432node\\ # Account for 64-bit windows
-        {
-            local install-path = [ 
-              registry-value 
"SOFTWARE\\"$(x64elt)"Python\\PythonCore\\"$(v)"\\InstallPath" ] ;
-            
-            if $(install-path)
-            {
-                install-path = [ windows-path-to-native $(install-path) ] ;
-                debug-message Registry indicates Python $(v) installed at 
\"$(install-path)\" ;
-            }
+        local install-path = [ 
+          software-registry-value "Python\\PythonCore\\"$(v)"\\InstallPath" ] ;
             
-            interpreters += $(:E=python:R=$(install-path)) ;
+        if $(install-path)
+        {
+            install-path = [ windows-path-to-native $(install-path) ] ;
+            debug-message Registry indicates Python $(v) installed at 
\"$(install-path)\" ;
         }
+            
+        interpreters += $(:E=python:R=$(install-path)) ;
     }
     return $(interpreters) ;
 }
@@ -461,9 +470,8 @@
     }
 }
 
-# Make sure the "executable", "libraries", and "includes" variables
-# (in an enclosing scope) have a value, based on the information
-# given.
+# Make sure the "libraries" and "includes" variables (in an enclosing
+# scope) have a value based on the information given.
 local rule compute-default-paths ( 
   target-os : version ? : prefix ? : exec-prefix ? )
 {
@@ -471,20 +479,11 @@
     
     if $(target-os) = windows
     {
-        # The exec-prefix is where you're supposed to look for
+        # The exec_prefix is where you're supposed to look for
         # machine-specific libraries.
-        local default-library-path = $(:E=libs:R=$(exec-prefix)) ;
+        local default-library-path = $(exec-prefix)\\libs ;
         local default-include-path = $(:E=Include:R=$(prefix)) ;
         
-        if $(default-library-path)
-        {
-            default-library-path = [ path-to-native $(default-library-path) ] ;
-        }
-        if $(default-include-path)
-        {
-            default-include-path = [ path-to-native $(default-include-path) ] ;
-        }
-        
         # If the interpreter was found in a directory
         # called "PCBuild" or "PCBuild8," assume we're
         # looking at a Python built from the source
@@ -502,11 +501,10 @@
             debug-message "This Python appears to reside in a source 
distribution;" ;
             debug-message "prepending \""$(executable-dir)"\" to default 
library search path" ;
             
-            default-library-path = [ path-to-native $(executable-dir) ] 
+            default-library-path = $(executable-dir)
               $(default-library-path) ;
             
-            default-include-path = [ path-to-native 
$(:E=PC:R=$(executable-dir:D)) ] 
-              $(default-include-path) ;
+            default-include-path = $(:E=PC:R=$(executable-dir:D)) 
$(default-include-path) ;
             
             debug-message "and \""$(default-include-path[1])"\" to default 
#include path" ;
         }
@@ -516,13 +514,10 @@
     }
     else
     {
-        # $(prefix)/include/python$(version) 
-        includes ?= [ path-to-native 
$(:E=python$(version):R=$(:E=include:R=$(prefix))) ] ;
+        includes ?= $(prefix)/include/python$(version) ;
         
-        # $(exec-prefix)/lib/python$(version)/config $(exec-prefix)/lib
-        local lib = [ path-to-native $(:E=lib:R=$(exec-prefix)) ] ;
-        libraries ?= [ path-to-native 
$(:E=config:R=$(:E=python$(version):R=$(lib))) ] 
-          [ path-to-native $(lib) ] ;
+        local lib = $(exec-prefix)/lib ;
+        libraries ?= $(lib)/python$(version)/config $(lib) ;
     }
 }
 
@@ -530,14 +525,9 @@
 feature.feature python : : propagated ;
 
 # Return a list of candidate commands to try when looking for a Python
-# interpreter.
+# interpreter.  prefix is expected to be a native path.
 local rule candidate-interpreters ( version ? : prefix ? : target-os )
 {
-    if $(prefix)
-    {
-        prefix = [ path-to-native $(prefix) ] ;
-    }
-    
     local bin-path = bin ;
     if $(target-os) = windows
     {
@@ -644,6 +634,7 @@
   version ? : cmd-or-prefix ? : includes ? : libraries ? : condition * )
 {
     local prefix ;
+    local exec-prefix ;
     local cmds-to-try ;
     local interpreter-cmd ;
     
@@ -728,11 +719,14 @@
                 {
                     debug-message ...requested configuration matched! ;
                     
+                    exec-prefix = $(sys.exec_prefix) ;
+                    
                     compute-default-paths
-                      $(target-os) : $(sys.version) 
-                        : $(sys.prefix)
-                          : $(sys.exec_prefix)
-                              ;
+                      $(target-os)
+                        : $(sys.version)
+                          : $(sys.prefix)
+                            : $(sys.exec_prefix) ;
+                    
                     version = $(sys.version) ;
                     interpreter-cmd ?= $(cmd) ;
                     cmds-to-try = ; # All done.
@@ -760,13 +754,23 @@
                     ECHO warning: falling back to \"$(interpreter-cmd)\" ;
                 }
             }
-            compute-default-paths $(target-os) : $(version) : $(sys.prefix:E=) 
;
+            exec-prefix ?= $(prefix) ;
+            compute-default-paths $(target-os) : $(version) : $(prefix:E=) ;
         }
     }
     
-    debug-message "Python interpreter command is" 
\"$(interpreter-cmd:E=<empty>)\" ;
-    debug-message "Python include path is" \"$(includes:E=<empty>)\" ;
-    debug-message "Python library path is" \"$(libraries:E=<empty>)\" ;
+    includes = [ path-to-native $(includes) ] ;
+    libraries = [ path-to-native $(libraries) ] ;
+    
+    debug-message "Details of this Python configuration:" ;
+    debug-message "  interpreter command:" \"$(interpreter-cmd:E=<empty>)\" ;
+    debug-message "  include path:" \"$(includes:E=<empty>)\" ;
+    debug-message "  library path:" \"$(libraries:E=<empty>)\" ;
+    if $(target-os) = windows
+    {
+        debug-message "  DLL search path:" \"$(exec-prefix:E=<empty>)\" ;
+    }
+    
     
     #
     # End autoconfiguration sequence
@@ -825,9 +829,9 @@
 
     # Make sure that we can find the Python DLL on windows
     local dll-path ;
-    if $(target-os) = windows && $(sys.exec_prefix)
+    if $(target-os) = windows && $(exec-prefix)
     {
-        dll-path += $(sys.exec_prefix) ;
+        dll-path += $(exec-prefix) ;
     }
     
     #
@@ -853,7 +857,7 @@
           :
             # why python.lib must be listed here instead of along with
             # the system libs is a mystery, but if we don't do it, on
-            # cygwin -lpythonX.Y never appears in the command line
+            # cygwin, -lpythonX.Y never appears in the command line
             # (although it does on linux).
           : <include>$(includes) <library-path>$(libraries) 
<dll-path>$(dll-path) <library>python.lib
           ;


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to