larry.velazquez at gmail.com
Sun Dec 16 21:44:49 PST 2012
On Dec 16, 2012, at 11:06 PM, Craig Treleaven <ctreleaven at cogeco.ca> wrote:
> I was just curious why a lot of the Python scripts I've run across use the env trick. Sounds like it was a workaround as the path to the python executable was unpredictable on some systems.
A couple of possibilities come to mind.
(A) The way execve(2) tokenizes shebang lines is not standardized. Given a file "foo.pl" starting with "#!/usr/bin/env perl -w", OS X and other BSDs execute /usr/bin/env with the args "perl", "-w", and "foo.pl", while Linux passes "perl -w" and "foo.pl". Obviously, "perl -w" is not the name of an interpreter. If Perl scripts commonly include options in the shebang line, using /usr/bin/env could cause portability issues.
(B) It's fairly common to isolate Python programs and apps inside sandboxes like virtualenv, which install an interpreter and its associated libraries and modules inside a directory of your choosing. I don't know how common this sort of thing is in the Perl world.
(C) Could just be a chance cultural difference, for no good reason.
More information about the macports-dev