I use Mac OSX, and my /usr/bin directory contains three versions of
the easy_install script: easy_install, easy_install-2.5, and
easy_install-2.6.
Based on some debugging lines I tried inserting, when I execute the
script called simply "easy_install", the script seems to execute just
the first line (namely "#!/usr/bin/python"), and then seems to
immediately jump to executing easy_install-2.6.
I was curious about the mechanism that allows the Python interpreter
to jump mysteriously from one file to another. This doesn't seem to
be evident from the easy_install scripts themselves. What causes this
behavior?
Thanks,
--Chris
_______________________________________________
Distutils-SIG maillist - Distut...@python.org
http://mail.python.org/mailman/listinfo/distutils-sig
On Thu, Oct 27, 2011 at 7:43 PM, Chris Jerdonek
<chris.j...@gmail.com> wrote:
> Hi, I have one more question for the time being. This regards how the
> easy_install script works.
>
> I use Mac OSX, and my /usr/bin directory contains three versions of
> the easy_install script: easy_install, easy_install-2.5, and
> easy_install-2.6.
>
> Based on some debugging lines I tried inserting, when I execute the
> script called simply "easy_install", the script seems to execute just
> the first line (namely "#!/usr/bin/python"), and then seems to
> immediately jump to executing easy_install-2.6.
>
> I was curious about the mechanism that allows the Python interpreter
> to jump mysteriously from one file to another. This doesn't seem to
> be evident from the easy_install scripts themselves. What causes this
> behavior?
It appears to be this way, because your /usr/bin/python points to python2.6.
$ ls -l `which python`
lrwxrwxrwx 1 root root 9 2011-09-09 20:29 /usr/bin/python -> python2.6*
you can verify that no jumping occurs by printing a unique string in each of
`which easy_install` `which easy_install-2.6` `which easy_install-2.5`
--
Paul Ivanov
314 address only used for lists, off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7
That's what I did to observe the behavior:
If I insert "echo AAA" at the beginning of /usr/bin/easy_install,
running easy_install displays "AAA" as the first line of output.
However, when I remove "echo AAA" from the beginning of easy_install
and insert an exit statement right after the first line--
#!/usr/bin/python
exit('BBB')
as well as an exit statement right after the first line of
easy_install-2.5 (I meant to say 2.5 before)--
#!/System/Library/.../Python
print 'CCC'
running easy_install displays "CCC" rather than "BBB". So the
interpreter seems to have jumped from the first line of easy_install
to the beginning of easy_install-2.5 -- without executing the second
line of easy_install.
--Chris
> Hi Chris,
>
> On Thu, Oct 27, 2011 at 7:43 PM, Chris Jerdonek
> <chris.j...@gmail.com> wrote:
> > Hi, I have one more question for the time being. This regards how the
> > easy_install script works.
> >
> > I use Mac OSX, and my /usr/bin directory contains three versions of
> > the easy_install script: easy_install, easy_install-2.5, and
> > easy_install-2.6.
> >
> > Based on some debugging lines I tried inserting, when I execute the
> > script called simply "easy_install", the script seems to execute just
> > the first line (namely "#!/usr/bin/python"), and then seems to
> > immediately jump to executing easy_install-2.6.
> >
> > I was curious about the mechanism that allows the Python interpreter
> > to jump mysteriously from one file to another. This doesn't seem to
> > be evident from the easy_install scripts themselves. What causes this
> > behavior?
>
> It appears to be this way, because your /usr/bin/python points to python2.6.
> $ ls -l `which python`
> lrwxrwxrwx 1 root root 9 2011-09-09 20:29 /usr/bin/python -> python2.6*
>
> you can verify that no jumping occurs by printing a unique string in each of
> `which easy_install` `which easy_install-2.6` `which easy_install-2.5`
Actually, it doesn't work that way on recent releases of Mac OS X.
Apple implemented its own modifications to both Python and easy_install
(setuptools) to support multiple versions; it does not use symlinks
(unlike the MacPorts "port select" mechanism). Rather, /usr/bin/python
is a special wrapper executable and /usr/bin/easy_install a wrapper
script that support persistently setting the default version in a plist
via the defaults(1) command and/or temporarily changing the default via
environment variable settings. The mechanism is documented in the Apple
man page for python. Since neither /usr/bin/python nor
/usr/bin/easy_install are symlinks, it's really important not to
overwrite them.
--
Ned Deily,
n...@acm.org