Opened 8 years ago

Closed 6 years ago

#2244 defect closed fixed (fixed)

Patch to setup.py to work with python installs in directories containing a space

Reported by: Sandra24 Owned by:
Priority: normal Milestone:
Component: core Keywords:
Cc: Branch:
Author: Launchpad Bug:

Description

If Python is isntalled in a directory containing a space (like C:\Program Files)
os.spawnv will try passing python C:\program files... as an argument, and of course it breaks arguments on spaces, and it rather takes exception to C:\program as it's first argument.

Change:

if sumoMode:

result = runInDir(os.path.dirname(setupPy), os.spawnv,

os.P_WAIT, sys.executable,
[sys.executable, 'setup.py'] + args)

else:

result = os.spawnv(os.P_WAIT, sys.executable,

[sys.executable, setupPy] + args)

To:

if sumoMode:

result = runInDir(os.path.dirname(setupPy), os.spawnv,

os.P_WAIT, sys.executable,
+ sys.executable + '"', 'setup.py'? + args)

else:

result = os.spawnv(os.P_WAIT, sys.executable,

+ sys.executable + '"', setupPy? + args)

Change History (4)

comment:1 Changed 8 years ago by glyph

Note: the fix proposed here is incorrect for non-Windows platforms.

Unquoting is supposed to be something that the shell does, and spawnv invokes the shell on Windows but on UNIX invokes the process directly. Fixing this in one spot is silly, since the setup.py may want to run other subprocesses and run into the same problem. Also, this fix only addresses the first argument, and will break again if there is, for example, a --prefix argument with a space in it.

The correct solution here is for the setup.py to have a spawnv-like function which includes, or better yet imports, something like twisted.python.win32.quoteArguments, and have a wrapper for spawnv that does platform detection and calls through that.

comment:2 Changed 6 years ago by therve

Chris: the setup.py has changed, so I guess we can close this one?

comment:3 Changed 6 years ago by radix

  • Resolution set to fixed
  • Status changed from new to closed

Yes, this particular problem has been made irrelevant because we no longer spawn setup.py scripts.

comment:4 Changed 3 years ago by <automation>

  • Owner radix deleted
Note: See TracTickets for help on using tickets.