[Python-checkins] r42359 - sandbox/trunk/setuptools/setuptools/command/easy_install.py

phillip.eby python-checkins at python.org
Tue Feb 14 20:08:00 CET 2006


Author: phillip.eby
Date: Tue Feb 14 20:07:56 2006
New Revision: 42359

Modified:
   sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
Fix a Windows problem when the Python executable is in a directory with
a ' ' in its name.


Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py	Tue Feb 14 20:07:56 2006
@@ -286,7 +286,7 @@
 
 
     def cant_write_to_target(self):
-        msg = """can't create or remove files in install directory 
+        msg = """can't create or remove files in install directory
 
 The following error occurred while trying to add or remove files in the
 installation directory:
@@ -316,7 +316,7 @@
 
 For information on other options, you may wish to consult the
 documentation at:
-    
+
   http://peak.telecommunity.com/EasyInstall.html
 
 Please make the appropriate changes for your system and try again.
@@ -341,15 +341,15 @@
         else:
             try:
                 f.write("import os;open(%r,'w').write('OK')\n" % (ok_file,))
-                f.close(); f=None   
+                f.close(); f=None
                 executable = sys.executable
-                if os.name=='nt':   
+                if os.name=='nt':
                     dirname,basename = os.path.split(executable)
                     alt = os.path.join(dirname,'pythonw.exe')
                     if basename.lower()=='python.exe' and os.path.exists(alt):
-                        # use pythonw.exe to avoid opening a console window 
+                        # use pythonw.exe to avoid opening a console window
                         executable = alt
-        
+                    if ' ' in executable: executable='"%s"' % executable
                 from distutils.spawn import spawn
                 spawn([executable,'-E','-c','pass'],0)
 
@@ -361,9 +361,9 @@
                     return True
             finally:
                 if f: f.close()
-                if os.path.exists(ok_file): os.unlink(ok_file) 
+                if os.path.exists(ok_file): os.unlink(ok_file)
                 if os.path.exists(pth_file): os.unlink(pth_file)
-                
+
         log.warn("TEST FAILED: %s does NOT support .pth files", instdir)
         return False
 
@@ -1483,7 +1483,7 @@
 usage: %(script)s [options] requirement_or_url ...
    or: %(script)s --help
 """
-    
+
     def gen_usage (script_name):
         script = os.path.basename(script_name)
         return USAGE % vars()
@@ -1495,7 +1495,7 @@
             return f()
         finally:
             distutils.core.gen_usage = old_gen_usage
-        
+
     class DistributionWithoutHelpCommands(Distribution):
         def _show_help(self,*args,**kw):
             with_ei_usage(lambda: Distribution._show_help(self,*args,**kw))
@@ -1505,7 +1505,7 @@
 
     with_ei_usage(lambda:
         setup(
-            script_args = ['-q','easy_install', '-v']+argv, 
+            script_args = ['-q','easy_install', '-v']+argv,
             distclass=DistributionWithoutHelpCommands, **kw
         )
     )


More information about the Python-checkins mailing list