Bug 1460475 - Port download-and-compress to Python 3; r?dustin
download-and-compress isn't very complicated and should work on Python 3
with minimal effort. So let's switch it to use Python 3.
MozReview-Commit-ID: 9G1WfcbbKEY
--- a/taskcluster/docker/image_builder/download-and-compress
+++ b/taskcluster/docker/image_builder/download-and-compress
@@ -1,9 +1,9 @@
-#!/usr/bin/python2.7
+#!/usr/bin/python3 -u
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os
import sys
import time
--- a/taskcluster/docker/image_builder/setup.sh
+++ b/taskcluster/docker/image_builder/setup.sh
@@ -4,25 +4,26 @@ set -v -e -x
export DEBIAN_FRONTEND=noninteractive
# Update apt-get lists
apt-get update -y
# Install dependencies
apt-get install -y --no-install-recommends \
socat \
+ python-requests \
+ python-requests-unixsocket \
python3.5 \
python3-minimal \
- python \
- python-requests \
- python-requests-unixsocket
+ python3-requests \
+ python3-requests-unixsocket
# Extra dependencies only needed for image building. Will be removed at
# end of script.
-apt-get install -y python-pip
+apt-get install -y python-pip python3-pip
# Install mercurial
# shellcheck disable=SC1091
. /setup/common.sh
# shellcheck disable=SC1091
. /setup/install-mercurial.sh
# Install build-image.sh script
@@ -44,21 +45,24 @@ tooltool_fetch <<EOF
"digest": "72b1fc542e5af36fc660d7b8d3882f0a25644d3b66316293717aabf9ba8cf578e49e2cf45e63e962c5535ec1f8b3e83248c379d34b0cab2ef1a950205ad153ce",
"algorithm": "sha512",
"filename": "zstandard-0.9.0.tar.gz"
}
]
EOF
)
+# We need to install for both Python 2 and 3 because `mach taskcluster-load-image`
+# uses Python 2 and `download-and-compress` uses Python 3.
/usr/bin/pip -v install /setup/zstandard-0.9.0.tar.gz
+/usr/bin/pip3 -v install /setup/zstandard-0.9.0.tar.gz
# python-pip only needed to install python-zstandard. Removing it removes
# several hundred MB of dependencies from the image.
-apt-get purge -y python-pip
+apt-get purge -y python-pip python3-pip
# Purge apt-get caches to minimize image size
apt-get auto-remove -y
apt-get clean -y
rm -rf /var/lib/apt/lists/
# Remove this script
rm -rf /setup/