[Distutils] install w/o build, spaces in directory names

Thomas Heller thomas.heller@ion-tof.com
Fri, 11 Feb 2000 14:07:11 +0100


> 1) While building Numerical on NT last night w/ the latest Distutils CVS
> snapshot, I found that it refused to build because the directory names had
> spaces in them which were not quoted. In other words, the code being
> executed when something like
>
> cl .... -IC:\Program Files\Python...
>
> which broke.  To correct it, I patched ccompiler.py and msvccompiler.py to
> turn those kinds of things into
>
> cl .... -I"C:\Program Files\Python..." ...
>
> but Greg says that that will break on Unix

I tried quoting the parameters for _spawn_nt in the following way,
which worked for me (after changing some paths to include spaces,
which I usually avoid). Not sure if cmd[0] should also be quoted:

*** distutils\spawn.py Fri Feb 11 13:40:10 2000
--- c:\python.org\distutils\distutils\spawn.py Mon Jan 17 22:57:56 2000
***************
*** 42,60 ****
  # spawn ()


- def _quote_if_needed (arg):
-     """Obscure quoting command line arguments on NT.
-        Simply quote every argument which contains blanks"""
-     if string.find (arg, ' ') == -1:
-         return arg
-     return '"%s"' % arg
-
  def _spawn_nt ( cmd,
                  search_path=1,
                  verbose=0,
                  dry_run=0):
      executable = cmd[0]
-     cmd[1:] = map (_quote_if_needed, cmd[1:])
      if search_path:
          paths = string.split( os.environ['PATH'], os.pathsep)
          base,ext = os.path.splitext(executable)
--- 42,52 ----

Thomas Heller