cros_setup_toolchain: Munge the shebang back to use "env"
In CL:719258 we're optimizing the shebang of the toolchain wrappers.
...but we can't necessarily use this optimized version outside the
chroot. Munge it back.
BUG=chromium:773138
TEST=See that things get munged back
Change-Id: I08e280bca46cd2f36049502cd87466d4f581895f
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/719719
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
diff --git a/scripts/cros_setup_toolchains.py b/scripts/cros_setup_toolchains.py
index 9b5a412..27708dd 100644
--- a/scripts/cros_setup_toolchains.py
+++ b/scripts/cros_setup_toolchains.py
@@ -1115,6 +1115,13 @@
for sysroot_wrapper in glob.glob(os.path.join(
output_dir + srcpath, 'sysroot_wrapper*')):
contents = osutils.ReadFile(sysroot_wrapper).splitlines()
+
+ # In order to optimize startup time in the chroot we run python a little
+ # differently there. Put it back to the more portable way here.
+ # See http://crbug.com/773138 for some details.
+ if contents[0] == '#!/usr/bin/python2 -S':
+ contents[0] = '#!/usr/bin/env python2'
+
for num in xrange(len(contents)):
if '@CCACHE_DEFAULT@' in contents[num]:
assert 'True' in contents[num]