Code review comment for lp://staging/~mikemc/dirspec/add-exefind

Revision history for this message
Mike McCracken (mikemc) wrote :

Regarding prepending 'python ', the issue is that the scripts now have
an absolute path to /usr/bin/python, but on windows and darwin we have
a buildout-generated python wrapper that sets up PYTHONPATH to point
to the eggs in the buildout directory, etc, so we need to use that.

One option would be to avoid using the buildout python, and either
just set PYTHONPATH to include all the eggs while developing, or use
virtualenv, or something. However, that's a rather big change.

If we want to stick with the buildout python, we need to just prepend
'python' to the cmdline and use Popen(shell=True).

All that said, I think it'd be fine to move that out of this general
library function. There'd just be a bit of extra code after we call it
each time:

cmdline = get_cmdline(blah)
if getattr(sys, "frozen", None) is None and
   sys.platform in ('win32','darwin'):
   # then we are in a source tree, using the buildout python wrapper,
   # and we need to make sure we run it using that, so that its path
   # makes sense.
   cmdline = 'python ' + cmdline

for ease of writing tests, we might also want to wrap that in a
function on the client end (ie, not in dirspec)

« Back to merge proposal