[py-svn] r12654 - in py/dist/py: path/local process

arigo at codespeak.net arigo at codespeak.net
Fri May 20 19:59:17 CEST 2005


Author: arigo
Date: Fri May 20 19:59:17 2005
New Revision: 12654

Modified:
   py/dist/py/path/local/local.py
   py/dist/py/process/cmdexec.py
Log:
Fixes for Windows ME.


Modified: py/dist/py/path/local/local.py
==============================================================================
--- py/dist/py/path/local/local.py	(original)
+++ py/dist/py/path/local/local.py	Fri May 20 19:59:17 2005
@@ -477,7 +477,13 @@
         else: 
             if py.std.sys.platform == 'win32': 
                 paths = py.std.os.environ['Path'].split(';')
-                paths = [re.sub('%SystemRoot%', os.environ['SYSTEMROOT'], path) for path in paths]
+                try:
+                    systemroot = os.environ['SYSTEMROOT']
+                except KeyError:
+                    pass
+                else:
+                    paths = [re.sub('%SystemRoot%', systemroot, path)
+                             for path in paths]
                 tryadd = '', '.exe', '.com', '.bat' # XXX add more? 
             else: 
                 paths = py.std.os.environ['PATH'].split(':') 

Modified: py/dist/py/process/cmdexec.py
==============================================================================
--- py/dist/py/process/cmdexec.py	(original)
+++ py/dist/py/process/cmdexec.py	Fri May 20 19:59:17 2005
@@ -84,9 +84,19 @@
     under Windows. Do a HELP CMD in a shell, and tell me if
     you understand this. For now, I try to do a fix.
     """
-    print "*****", cmd
-    if '"' in cmd and not cmd.startswith('""'):
-        cmd = '"%s"' % cmd
+    #print "*****", cmd
+
+    # the following quoting is only valid for CMD.EXE, not COMMAND.COM
+    cmd_quoting = True
+    try:
+        if os.environ['COMSPEC'].upper().endswith('COMMAND.COM'):
+            cmd_quoting = False
+    except KeyError:
+        pass
+    if cmd_quoting:
+        if '"' in cmd and not cmd.startswith('""'):
+            cmd = '"%s"' % cmd
+
     stdin, stdout, stderr = os.popen3(cmd)
     out = stdout.read()
     err = stderr.read()



More information about the pytest-commit mailing list