This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients bkabrda, chris.jerdonek, ncoghlan, nedbat, pitrou, serhiy.storchaka
Date 2012-07-30.00:55:38
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1343609739.76.0.773165348432.issue14803@psf.upfronthosting.co.za>
In-reply-to
Content
There are two different use cases here. "-C" tackles one of them, "PYTHONRUNFIRST" the other.

My original use case came from working on the Python test suite. In that suite, we have "test.script_helper" which spawns Python subprocesses in order to test various aspects of the startup machinery. I can easily modify script_helper to pass an extra -C argument when gathering coverage data, so I don't need any implicit magic.

The -C option also simplifies a whole host of things by letting you use the Python API to perform preconfiguration of various subsystems before executing __main__ normally rather than having to either write a custom launch script (difficult to do with full generality) or adding even more arcane command line options.

However, the -C option doesn't cover the case of *implicit* invocation of subprocesses. This is where the PYTHONRUNFIRST suggestion comes in - the idea would that, unless -E is specified, then -C $PYTHONRUNFIRST would be implied.

To be honest, I *don't* think this latter capability should be built into the core implementation. Instead, I think it is more appropriate for it to be handled at a virtual environment level, so that it doesn't inadvertently affect invocation of other applications (like hg) that merely happen to be written in Python. Scoping it to a venv would also lessen many of my security concerns with the idea. A simple way to do this would be if pyvenv.cfg could contain a customisation snippet that was executed prior to __main__ invocation (building off the -C machinery)
History
Date User Action Args
2012-07-30 00:55:39ncoghlansetrecipients: + ncoghlan, pitrou, nedbat, chris.jerdonek, serhiy.storchaka, bkabrda
2012-07-30 00:55:39ncoghlansetmessageid: <1343609739.76.0.773165348432.issue14803@psf.upfronthosting.co.za>
2012-07-30 00:55:39ncoghlanlinkissue14803 messages
2012-07-30 00:55:38ncoghlancreate