Message143610
| Author |
twouters |
| Recipients |
brandon-rhodes, brett.cannon, eric.araujo, eric.snow, ezio.melotti, ncoghlan, nedbat, sandro.tosi, twouters |
| Date |
2011年09月06日.15:00:12 |
| SpamBayes Score |
1.5498713e-13 |
| Marked as misclassified |
No |
| Message-id |
<1315321214.18.0.128892713458.issue11561@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
For what it's worth, the need for a bootstrap-module has also come up within Google, where we have... somewhat different requirements than most. In order to fix import paths in a way that works even when using "python -S", I had a need to patch the very first module that gets imported. Unfortunately the actual first module that gets imported depends on the arguments passed to Python. So, I wrote the attached stdlib_landmark.diff patch, which makes a 'stdlib_landmark.py' file that is both the stdlib landmark (used by Python to find the stdlib itself, currently 'os.py') *and* the very first module that is imported, always.
(The 'stdlib_landmark' name may be a little clunky; a better name, mirroring sitecustomize, may be "stdlibcustomize" or such.)
And yes, this could have been fixed in other ways. I could've patched the interpreter directly, or made Python understand symlinks to .py/.pyc files better, or tried to make a bunch of other tools work better with symlinks. This has turned out the most convenient solution for a number of reasons, though. |
|