switch default SDK python to 3.6

Any scripts needing a specific version of Python should be using
`python2` in their shebang at this point.  Lets switch the default
over to Python 3 so we can prevent regressions.

BUG=chromium:981405
TEST=SDK bot passes

Change-Id: Iff92e4b127aeb932c8c76dda2ae34a09f9e0c2ed
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosutils/+/1757296
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Chris McDonald <cjmcdonald@chromium.org>
diff --git a/chroot_version_hooks.d/174_python3_sdk_default b/chroot_version_hooks.d/174_python3_sdk_default
new file mode 100644
index 0000000..73a382c
--- /dev/null
+++ b/chroot_version_hooks.d/174_python3_sdk_default
@@ -0,0 +1,14 @@
+# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Set Python 3 as the default implementation.
+sudo eselect python update
+
+# Install the new symlinks.  This is normally handled only when the SDK is
+# first created.
+sudo ln -sfT /mnt/host/source/chromite \
+  /usr/lib64/python3.6/site-packages/chromite
+
+# Sanity check.
+python -c 'import sys; assert sys.version_info.major >= 3'
diff --git a/sdk_lib/make_chroot.sh b/sdk_lib/make_chroot.sh
index d9e5994..809b12f 100755
--- a/sdk_lib/make_chroot.sh
+++ b/sdk_lib/make_chroot.sh
@@ -571,12 +571,8 @@
 # Add version of stage3 for update checks.
 echo "STAGE3=${FLAGS_stage3_path}" > "${CHROOT_STATE}"
 
-# New versions of the stage3 have Python 3 set as the default. Make sure we
-# default to 2.x as our scripts are only compatible with Python 2. We leave
-# Python 3 installed though as we've started including it in our SDK.
-# We can't just "set 1" because the option order changes for different stage3
-# tarballs.
-early_enter_chroot eselect python update --ignore "3*"
+# Switch SDK python to Python 3 by default.
+early_enter_chroot eselect python update
 
 info "Updating portage"
 early_enter_chroot emerge -uNv --quiet portage
@@ -591,7 +587,7 @@
 fi
 
 # Add chromite into python path.
-for python_path in "${FLAGS_chroot}/usr/lib/"python2.*; do
+for python_path in "${FLAGS_chroot}/usr/lib/"python*.*; do
   python_path+="/site-packages"
   sudo mkdir -p "${python_path}"
   sudo ln -s -fT "${CHROOT_TRUNK_DIR}"/chromite "${python_path}"/chromite