From 421a71e1458714e072b441585d6b38290adabb0e Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Tue, 9 Jun 2020 09:30:56 -0700 Subject: [PATCH] Be explicit about using python3 in docker images Our docker python-base image is a python3 image where python and python3 point to the same version of python which happens to be a 3.x depending on the specific base image. One of the things that came up at the PTG is that we'd like to start identifying where we use python2 in order to port to python3. That is made a bit more difficult when we use `python` assuming it is `python3` as we do in our docker images. Update the images to use `python3` to make this a lot more explicit and clear that we don't need to port these items. Change-Id: I54e8f128f0cb8fbbdf54e3748384470262bef3a9 --- docker/accessbot/accessbot.py | 2 +- docker/accessbot/accessbot.sh | 2 +- docker/gitea-init/entrypoint.sh | 2 +- docker/haproxy-statsd/haproxy-statsd.py | 2 +- docker/jinja-init/Dockerfile | 2 +- docker/python-builder/scripts/assemble | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker/accessbot/accessbot.py b/docker/accessbot/accessbot.py index 39d7134245..0459ccdd30 100755 --- a/docker/accessbot/accessbot.py +++ b/docker/accessbot/accessbot.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 # Copyright 2011, 2013-2014 OpenStack Foundation # Copyright 2012 Hewlett-Packard Development Company, L.P. diff --git a/docker/accessbot/accessbot.sh b/docker/accessbot/accessbot.sh index a3c0dee424..f0dbb4bd87 100755 --- a/docker/accessbot/accessbot.sh +++ b/docker/accessbot/accessbot.sh @@ -14,4 +14,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -exec python /usr/local/bin/accessbot.py -c /etc/accessbot/accessbot.config -l /etc/accessbot/channels.yaml >> /var/log/accessbot/accessbot.log 2>&1 +exec python3 /usr/local/bin/accessbot.py -c /etc/accessbot/accessbot.config -l /etc/accessbot/channels.yaml >> /var/log/accessbot/accessbot.log 2>&1 diff --git a/docker/gitea-init/entrypoint.sh b/docker/gitea-init/entrypoint.sh index fb927af296..39944e5993 100755 --- a/docker/gitea-init/entrypoint.sh +++ b/docker/gitea-init/entrypoint.sh @@ -33,4 +33,4 @@ mkdir -p /data/ssh # Template the config file (which can also be root-owned) export JINJA_SRC_FILE=/config_src/app.ini.j2 export JINJA_DEST_FILE=/conf/app.ini -python /run.py +python3 /run.py diff --git a/docker/haproxy-statsd/haproxy-statsd.py b/docker/haproxy-statsd/haproxy-statsd.py index 7f841e484a..5fe7b52071 100755 --- a/docker/haproxy-statsd/haproxy-statsd.py +++ b/docker/haproxy-statsd/haproxy-statsd.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright (C) 2015 Hewlett-Packard Development Company, L.P. # diff --git a/docker/jinja-init/Dockerfile b/docker/jinja-init/Dockerfile index 6f4ba22746..0397c7ac3a 100644 --- a/docker/jinja-init/Dockerfile +++ b/docker/jinja-init/Dockerfile @@ -31,4 +31,4 @@ RUN pip install jinja2 COPY --from=build /src/jinja-init/run.py / -ENTRYPOINT ["python", "/run.py"] +ENTRYPOINT ["python3", "/run.py"] diff --git a/docker/python-builder/scripts/assemble b/docker/python-builder/scripts/assemble index 7e1ebab8f1..7add890d65 100755 --- a/docker/python-builder/scripts/assemble +++ b/docker/python-builder/scripts/assemble @@ -51,7 +51,7 @@ function install_wheels { # in the output dir and not the wheel cache, so it's not # possible to tell what is the wheel for the project and # what is the wheel cache. - python setup.py sdist bdist_wheel -d /output/wheels + python3 setup.py sdist bdist_wheel -d /output/wheels # Install everything so that the wheel cache is populated with # transitive depends. If a requirements.txt file exists, install @@ -87,7 +87,7 @@ done # Use a clean virtualenv for install steps to prevent things from the # current environment making us not build a wheel. -python -m venv /tmp/venv +python3 -m venv /tmp/venv /tmp/venv/bin/pip install -U pip wheel # If there is an upper-constraints.txt file in the source tree,