diff Lib/platform.py @ 60132:a404e3702f79 legacy-trunk

#7092: Fix some -3 warnings, and fix Lib/platform.py when the path contains a double-quote.
author Florent Xicluna <florent.xicluna@gmail.com>
date Thu, 01 Apr 2010 18:17:09 +0000
parents 6df799a2c24e
children 7c90ac194e40
line wrap: on
line diff
--- a/Lib/platform.py	Thu Apr 01 17:56:57 2010 +0000
+++ b/Lib/platform.py	Thu Apr 01 18:17:09 2010 +0000
@@ -966,7 +966,7 @@
     if sys.platform in ('dos','win32','win16','os2'):
         # XXX Others too ?
         return default
-    target = _follow_symlinks(target)
+    target = _follow_symlinks(target).replace('"', '\\"')
     try:
         f = os.popen('file "%s" 2> %s' % (target, DEV_NULL))
     except (AttributeError,os.error):
@@ -1032,13 +1032,13 @@
        executable == sys.executable:
         # "file" command did not return anything; we'll try to provide
         # some sensible defaults then...
-        if _default_architecture.has_key(sys.platform):
-            b,l = _default_architecture[sys.platform]
+        if sys.platform in _default_architecture:
+            b, l = _default_architecture[sys.platform]
             if b:
                 bits = b
             if l:
                 linkage = l
-        return bits,linkage
+        return bits, linkage
 
     # Split the output into a list of strings omitting the filename
     fileout = _architecture_split(output)[1:]