[Distutils] virtualenv, OS X, and GUIs

Robert Kern robert.kern at gmail.com
Wed Jan 9 08:14:39 CET 2008


Ronald Oussoren wrote:
> 
> On 9 Jan, 2008, at 1:47, Ian Bicking wrote:
> 
>> Robert Kern wrote:
>>> Is there an appropriate mailing list for talking about virtualenv? 
>>> I've run into a problem where virtualenvs on OS X cannot access the 
>>> screen to run GUIs. I've found a solution that appears to work and am 
>>> going to write a patch to let virtualenv do it. I'd like to get some 
>>> feedback from other OS X virtualenv users, though.
> 
> What's the solution?
> 
> It is currently not possible to use GUI api's from the commandline using 
> a virtualenv interpreter, but that's just basic OSX lameness. It works 
> in the system install because that uses some trickery to let the system 
> think that the interpreter is inside an application bundle (at the cost 
> of an extra fork(2)).

Basically, I replicated this procedure for the ~/virtualenv/. I copied the 
Python.app/ into the ~/virtualenv/, used the install_name_tool to point it 
~/virtualenv/.Python, and then compiled pythonw.c with a -D flag to point it to 
the executable in the copied Python.app. It's not particularly pretty, but it 
worked for me with python.org's Python 2.5 on Leopard.

That's good enough for me, but I'm wondering how robust that is going to be for 
others. Which framework builds do not have a Python.app? I notice that Leopard's 
2.3 doesn't, so I'm guessing that Tiger's didn't either. Were there releases of 
2.4 that didn't?

Should I bother trying to support Python 2.3? It doesn't look like virtualenv 
tries to.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco



More information about the Distutils-SIG mailing list