| # 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. |
| |
| # Drop Python 3.4 from the SDK as we've moved to Python 3.6 everywhere. |
| # Make sure 3.6 is installed in case this is an old chroot. |
| |
| echo "Cleaning up Python 3.4 to migrate to 3.6" |
| |
| export CLEAN_DELAY=0 |
| |
| # Install python 3.6 if the sdk is out of date. |
| if ! python3.6 --version >&/dev/null; then |
| sudo emerge -ug dev-lang/python:3.6 |
| fi |
| |
| # Point python3 to the new version. |
| sudo eselect python update --python3 |
| |
| # Remove python 3.4 from the system. |
| sudo emerge -Cq dev-lang/python:3.4 |
| |
| # Remove java-config if needed to avoid circular deps. |
| reinstall_java="false" |
| if ! python3.6 -c 'import java_config_2' >&/dev/null; then |
| reinstall_java="true" |
| sudo emerge -Cq dev-java/java-config |
| fi |
| |
| # Upgrade portage itself finally. |
| sudo emerge -Ugqv sys-apps/portage |
| |
| # Reinstall java-config in case we purged it. |
| if [[ "${reinstall_java}" == "true" ]]; then |
| sudo emerge -ugqv dev-java/java-config |
| fi |