Ronald Oussoren <ronaldoussoren <at> mac.com> writes:

> The 'env.cfg' file will be next to the stub executable, and hence not in a
location where the real
> interpreter will look.
> 
> > 2. How does the stub locate the real executable?
> 
> The stub is linked to the framework and uses that to find the sys.prefix, the
real executable is located in a
> fixed location relative to sys.prefix.
> 
> That's one other difference w.r.t. regular builds: framework builds use the
location of the shared
> library to calculate sys.prefix. AFAIK this functionality was inherited from
the NextStep port. 

Here's the approach I've taken to this - please comment.

1. I modified the stub loader to set an environment variable
"__PYTHONV_LAUNCHER__" to the absolute path of the stub executable itself. The
environment key seems unambiguous enough and shouldn't clash with anything else.
This might seem clunky, but seems the most obvious way to feed this information
to the real executable.
2. The stub is copied to an environment's bin folder (but nothing else is, for
the moment, though I've written the code to copy the dylib, Info.plist, real
executable etc it's currently commented out).
3. When the stub is run, it finds the framework executable in the usual way, and
runs it.
4. When the real executable gets control, code in site.py picks up the
environment variable's value and looks for the env.cfg relative to that 
location.

AFAICT this should be enough, since the real executable is executed from its
framework location and presumably has access to all tbe necessary context for
GUI applications, etc. I've verified that sys.site_prefix, sys.site_exec_prefix
and sys.path correctly point to the virtual environment.

I ran the full regression test suite in a virtual env, and only got failures in
test_lib2to3 and test_packaging (due to known issues with those tests writing
into write-protected locations - this happens with vanilla installed Python 3.3,
too).

> PyObjC supports Python 3, the site is very much out of date. I haven't found
time to redesign the site yet,
> which needs to be done because the maintanence scripts no longer work due to
some code reorganisations in
> PyObjC itself.

Are there instructions somewhere on how to build and integrate into a framework
build's Extras?

Regards,

Vinay Sajip

_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: http://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to