Purpose of embedding Repo python code into bash script

88 views
Skip to first unread message

needle

unread,
Mar 3, 2011, 10:48:42 AM3/3/11
to Repo and Gerrit Discussion
Hi,

Although the way of calling python from shell script in repo is really
stylish, I'm questioning why a simple #!/usr/bin/env isn't used.

As a remainder, the implementation is :

magic='--calling-python-from-/bin/sh--'
"""exec" python -E "$0" "$@" """#$magic"

I think there is a valuable reason, but I can't figure it out.

Thanks

Shawn Pearce

unread,
Mar 3, 2011, 12:25:21 PM3/3/11
to needle, Repo and Gerrit Discussion

We need to pass the -E flag, but env on some platforms wasn't taking
it. So I cooked up this work around. It mostly had to do with our
internal desktops at Google; they have a lot of PYTHON environment
flags that we didn't want to inherit into the repo process (because
they are there for normal Google engineers, not Android Google
engineers), and at least at the time env on either Mac OS or Linux (I
can't remember which) was rejecting a shbang line of "#!/usr/bin/env
python -E".

Paul Fariello

unread,
Mar 3, 2011, 2:20:50 PM3/3/11
to Shawn Pearce, Repo and Gerrit Discussion
Here is the valuable reason.

Thanks for that quick reply.

Le 03/03/11 18:25, Shawn Pearce a écrit :

--
Paul Fariello

Étudiant ingénieur à l'Université de Technologie de Troyes

paul.f...@gmail.com


signature.asc
Reply all
Reply to author
Forward
0 new messages