[Pythonmac-SIG] Yet another problem with two Pythons on Panth er
Jack Jansen
Jack.Jansen at cwi.nl
Tue Dec 16 15:43:30 EST 2003
On 16-dec-03, at 15:44, Schollnick, Benjamin wrote:
> I'm not sure this will help, especially since my use of distutils,
> is
> next to zero...
>
> But what about checking to see if distutils has been imported? If
> it has
> been imported, and we're running the setup.py application (i.e.
> argv[0] )
> then it's a application that is attempting to install a
> application...
Problem is that the startup code is run before distutils is imported.
But: we could conceivably do the mods only if the script name is
"setup.py",
but that is even a bit too gross for me:-)
And Bob suggested:
> How about just making a folder somewhere, let's call it, stdlib-fixes,
> and putting the fixed distutils in there. Then you would create a
> sitecustomization.py (or PYTHONPATH, etc.) hook to put that before the
> normal stdlib in sys.path. This should probably work, since I don't
> think any modules in the stdlib depend on distutils.
This would work, and there's even a way to do this without touching
sitecustomize.py: any line in a ".pth" file that starts with "import "
is simply executed. So there's nothing to stop us from creating a file
macpython-update-23.pth with the contents
import sys; if sys.version_info[:3] == (2, 3, 0): sys.path.insert(1,
"/Library/Python/2.3/macpython-update-23")
(this is the trick I wasn't going to tell you about:-)
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma
Goldman
More information about the Pythonmac-SIG
mailing list