From 489216fd727986a1a3c96b936e6e5456a98adc63 Mon Sep 17 00:00:00 2001 From: Jamie Hewland Date: Wed, 3 May 2017 10:53:18 +0200 Subject: [PATCH] Upstream: Switch to unconditional invocation of "get-pip.py" * docker-library/python#194 --- 2.7/Dockerfile | 51 ++++++++++++++++++++++++++------------------ 3.5/Dockerfile | 58 ++++++++++++++++++++++++++++---------------------- 3.6/Dockerfile | 58 ++++++++++++++++++++++++++++---------------------- 3 files changed, 94 insertions(+), 73 deletions(-) diff --git a/2.7/Dockerfile b/2.7/Dockerfile index 4b7d67c..4cb1df9 100644 --- a/2.7/Dockerfile +++ b/2.7/Dockerfile @@ -10,9 +10,6 @@ ENV LANG C.UTF-8 ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF ENV PYTHON_VERSION 2.7.13 -# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 9.0.1 - RUN set -ex \ && apk add --no-cache --virtual .fetch-deps \ gnupg \ @@ -42,23 +39,6 @@ RUN set -ex \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ - \ - && find /usr/local -depth \ - \( \ - \( -type d -a -name test -o -name tests \) \ - -o \ - \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ - \) -exec rm -rf '{}' + \ && runDeps="$( \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ @@ -68,7 +48,36 @@ RUN set -ex \ )" \ && apk add --virtual .python-rundeps $runDeps \ && apk del .build-deps \ - && rm -rf /usr/src/python ~/.cache + \ + && find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python + +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py # HACK: Fix for building numpy # https://github.com/docker-library/python/issues/112#issuecomment-238383259 diff --git a/3.5/Dockerfile b/3.5/Dockerfile index a99be53..636c3df 100644 --- a/3.5/Dockerfile +++ b/3.5/Dockerfile @@ -10,14 +10,11 @@ ENV LANG C.UTF-8 ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D ENV PYTHON_VERSION 3.5.3 -# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 9.0.1 - RUN set -ex \ && apk add --no-cache --virtual .fetch-deps \ gnupg \ tar \ - \ + \ && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ && export GNUPGHOME="$(mktemp -d)" \ @@ -39,29 +36,10 @@ RUN set -ex \ && ./configure \ --enable-loadable-sqlite-extensions \ --enable-shared \ + --without-ensurepip \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ \ -# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere - && if [ ! -e /usr/local/bin/pip3 ]; then : \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ - ; fi \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ - \ - && find /usr/local -depth \ - \( \ - \( -type d -a -name test -o -name tests \) \ - -o \ - \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ - \) -exec rm -rf '{}' + \ && runDeps="$( \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ @@ -71,16 +49,44 @@ RUN set -ex \ )" \ && apk add --virtual .python-rundeps $runDeps \ && apk del .build-deps \ - && rm -rf /usr/src/python ~/.cache + \ + && find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ && ln -s python3-config python-config +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py + # HACK: Fix for building numpy # https://github.com/docker-library/python/issues/112#issuecomment-238383259 RUN ln -s /usr/include/locale.h /usr/include/xlocale.h diff --git a/3.6/Dockerfile b/3.6/Dockerfile index 1254339..12455f7 100644 --- a/3.6/Dockerfile +++ b/3.6/Dockerfile @@ -10,14 +10,11 @@ ENV LANG C.UTF-8 ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D ENV PYTHON_VERSION 3.6.1 -# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" -ENV PYTHON_PIP_VERSION 9.0.1 - RUN set -ex \ && apk add --no-cache --virtual .fetch-deps \ gnupg \ tar \ - \ + \ && wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \ && wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \ && export GNUPGHOME="$(mktemp -d)" \ @@ -39,29 +36,10 @@ RUN set -ex \ && ./configure \ --enable-loadable-sqlite-extensions \ --enable-shared \ + --without-ensurepip \ && make -j$(getconf _NPROCESSORS_ONLN) \ && make install \ \ -# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere - && if [ ! -e /usr/local/bin/pip3 ]; then : \ - && wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \ - && python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \ - && rm /tmp/get-pip.py \ - ; fi \ -# we use "--force-reinstall" for the case where the version of pip we're trying to install is the same as the version bundled with Python -# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages") -# https://github.com/docker-library/python/pull/143#issuecomment-241032683 - && pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \ -# then we use "pip list" to ensure we don't have more than one pip version installed -# https://github.com/docker-library/python/pull/100 - && [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \ - \ - && find /usr/local -depth \ - \( \ - \( -type d -a -name test -o -name tests \) \ - -o \ - \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ - \) -exec rm -rf '{}' + \ && runDeps="$( \ scanelf --needed --nobanner --recursive /usr/local \ | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ @@ -71,16 +49,44 @@ RUN set -ex \ )" \ && apk add --virtual .python-rundeps $runDeps \ && apk del .build-deps \ - && rm -rf /usr/src/python ~/.cache + \ + && find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' + \ + && rm -rf /usr/src/python # make some useful symlinks that are expected to exist RUN cd /usr/local/bin \ - && { [ -e easy_install ] || ln -s easy_install-* easy_install; } \ && ln -s idle3 idle \ && ln -s pydoc3 pydoc \ && ln -s python3 python \ && ln -s python3-config python-config +# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value ''" +ENV PYTHON_PIP_VERSION 9.0.1 + +RUN set -ex; \ + \ + wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \ + \ + python get-pip.py \ + --disable-pip-version-check \ + --no-cache-dir \ + "pip==$PYTHON_PIP_VERSION" \ + ; \ + pip --version; \ + \ + find /usr/local -depth \ + \( \ + \( -type d -a -name test -o -name tests \) \ + -o \ + \( -type f -a -name '*.pyc' -o -name '*.pyo' \) \ + \) -exec rm -rf '{}' +; \ + rm -f get-pip.py + # HACK: Fix for building numpy # https://github.com/docker-library/python/issues/112#issuecomment-238383259 RUN ln -s /usr/include/locale.h /usr/include/xlocale.h