Skip to content
This repository was archived by the owner on Mar 28, 2019. It is now read-only.

Commit 489216f

Browse files
committed
Upstream: Switch to unconditional invocation of "get-pip.py"
* docker-library/python#194
1 parent ebc1388 commit 489216f

File tree

3 files changed

+94
-73
lines changed

3 files changed

+94
-73
lines changed

2.7/Dockerfile

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ ENV LANG C.UTF-8
1010
ENV GPG_KEY C01E1CAD5EA2C4F0B8E3571504C367C218ADD4FF
1111
ENV PYTHON_VERSION 2.7.13
1212

13-
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
14-
ENV PYTHON_PIP_VERSION 9.0.1
15-
1613
RUN set -ex \
1714
&& apk add --no-cache --virtual .fetch-deps \
1815
gnupg \
@@ -42,23 +39,6 @@ RUN set -ex \
4239
&& make -j$(getconf _NPROCESSORS_ONLN) \
4340
&& make install \
4441
\
45-
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
46-
&& python2 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
47-
&& rm /tmp/get-pip.py \
48-
# 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
49-
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
50-
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
51-
&& pip install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
52-
# then we use "pip list" to ensure we don't have more than one pip version installed
53-
# https://github.com/docker-library/python/pull/100
54-
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
55-
\
56-
&& find /usr/local -depth \
57-
\( \
58-
\( -type d -a -name test -o -name tests \) \
59-
-o \
60-
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
61-
\) -exec rm -rf '{}' + \
6242
&& runDeps="$( \
6343
scanelf --needed --nobanner --recursive /usr/local \
6444
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
@@ -68,7 +48,36 @@ RUN set -ex \
6848
)" \
6949
&& apk add --virtual .python-rundeps $runDeps \
7050
&& apk del .build-deps \
71-
&& rm -rf /usr/src/python ~/.cache
51+
\
52+
&& find /usr/local -depth \
53+
\( \
54+
\( -type d -a -name test -o -name tests \) \
55+
-o \
56+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
57+
\) -exec rm -rf '{}' + \
58+
&& rm -rf /usr/src/python
59+
60+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
61+
ENV PYTHON_PIP_VERSION 9.0.1
62+
63+
RUN set -ex; \
64+
\
65+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
66+
\
67+
python get-pip.py \
68+
--disable-pip-version-check \
69+
--no-cache-dir \
70+
"pip==$PYTHON_PIP_VERSION" \
71+
; \
72+
pip --version; \
73+
\
74+
find /usr/local -depth \
75+
\( \
76+
\( -type d -a -name test -o -name tests \) \
77+
-o \
78+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
79+
\) -exec rm -rf '{}' +; \
80+
rm -f get-pip.py
7281

7382
# HACK: Fix for building numpy
7483
# https://github.com/docker-library/python/issues/112#issuecomment-238383259

3.5/Dockerfile

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ ENV LANG C.UTF-8
1010
ENV GPG_KEY 97FC712E4C024BBEA48A61ED3A5CA953F73C700D
1111
ENV PYTHON_VERSION 3.5.3
1212

13-
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
14-
ENV PYTHON_PIP_VERSION 9.0.1
15-
1613
RUN set -ex \
1714
&& apk add --no-cache --virtual .fetch-deps \
1815
gnupg \
1916
tar \
20-
\
17+
\
2118
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
2219
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
2320
&& export GNUPGHOME="$(mktemp -d)" \
@@ -39,29 +36,10 @@ RUN set -ex \
3936
&& ./configure \
4037
--enable-loadable-sqlite-extensions \
4138
--enable-shared \
39+
--without-ensurepip \
4240
&& make -j$(getconf _NPROCESSORS_ONLN) \
4341
&& make install \
4442
\
45-
# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
46-
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
47-
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
48-
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
49-
&& rm /tmp/get-pip.py \
50-
; fi \
51-
# 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
52-
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
53-
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
54-
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
55-
# then we use "pip list" to ensure we don't have more than one pip version installed
56-
# https://github.com/docker-library/python/pull/100
57-
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
58-
\
59-
&& find /usr/local -depth \
60-
\( \
61-
\( -type d -a -name test -o -name tests \) \
62-
-o \
63-
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
64-
\) -exec rm -rf '{}' + \
6543
&& runDeps="$( \
6644
scanelf --needed --nobanner --recursive /usr/local \
6745
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
@@ -71,16 +49,44 @@ RUN set -ex \
7149
)" \
7250
&& apk add --virtual .python-rundeps $runDeps \
7351
&& apk del .build-deps \
74-
&& rm -rf /usr/src/python ~/.cache
52+
\
53+
&& find /usr/local -depth \
54+
\( \
55+
\( -type d -a -name test -o -name tests \) \
56+
-o \
57+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
58+
\) -exec rm -rf '{}' + \
59+
&& rm -rf /usr/src/python
7560

7661
# make some useful symlinks that are expected to exist
7762
RUN cd /usr/local/bin \
78-
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
7963
&& ln -s idle3 idle \
8064
&& ln -s pydoc3 pydoc \
8165
&& ln -s python3 python \
8266
&& ln -s python3-config python-config
8367

68+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
69+
ENV PYTHON_PIP_VERSION 9.0.1
70+
71+
RUN set -ex; \
72+
\
73+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
74+
\
75+
python get-pip.py \
76+
--disable-pip-version-check \
77+
--no-cache-dir \
78+
"pip==$PYTHON_PIP_VERSION" \
79+
; \
80+
pip --version; \
81+
\
82+
find /usr/local -depth \
83+
\( \
84+
\( -type d -a -name test -o -name tests \) \
85+
-o \
86+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
87+
\) -exec rm -rf '{}' +; \
88+
rm -f get-pip.py
89+
8490
# HACK: Fix for building numpy
8591
# https://github.com/docker-library/python/issues/112#issuecomment-238383259
8692
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h

3.6/Dockerfile

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@ ENV LANG C.UTF-8
1010
ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
1111
ENV PYTHON_VERSION 3.6.1
1212

13-
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
14-
ENV PYTHON_PIP_VERSION 9.0.1
15-
1613
RUN set -ex \
1714
&& apk add --no-cache --virtual .fetch-deps \
1815
gnupg \
1916
tar \
20-
\
17+
\
2118
&& wget -O python.tar.xz "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz" \
2219
&& wget -O python.tar.xz.asc "https://www.python.org/ftp/python/${PYTHON_VERSION%%[a-z]*}/Python-$PYTHON_VERSION.tar.xz.asc" \
2320
&& export GNUPGHOME="$(mktemp -d)" \
@@ -39,29 +36,10 @@ RUN set -ex \
3936
&& ./configure \
4037
--enable-loadable-sqlite-extensions \
4138
--enable-shared \
39+
--without-ensurepip \
4240
&& make -j$(getconf _NPROCESSORS_ONLN) \
4341
&& make install \
4442
\
45-
# explicit path to "pip3" to ensure distribution-provided "pip3" cannot interfere
46-
&& if [ ! -e /usr/local/bin/pip3 ]; then : \
47-
&& wget -O /tmp/get-pip.py 'https://bootstrap.pypa.io/get-pip.py' \
48-
&& python3 /tmp/get-pip.py "pip==$PYTHON_PIP_VERSION" \
49-
&& rm /tmp/get-pip.py \
50-
; fi \
51-
# 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
52-
# ("Requirement already up-to-date: pip==8.1.2 in /usr/local/lib/python3.6/site-packages")
53-
# https://github.com/docker-library/python/pull/143#issuecomment-241032683
54-
&& pip3 install --no-cache-dir --upgrade --force-reinstall "pip==$PYTHON_PIP_VERSION" \
55-
# then we use "pip list" to ensure we don't have more than one pip version installed
56-
# https://github.com/docker-library/python/pull/100
57-
&& [ "$(pip list |tac|tac| awk -F '[ ()]+' '$1 == "pip" { print $2; exit }')" = "$PYTHON_PIP_VERSION" ] \
58-
\
59-
&& find /usr/local -depth \
60-
\( \
61-
\( -type d -a -name test -o -name tests \) \
62-
-o \
63-
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
64-
\) -exec rm -rf '{}' + \
6543
&& runDeps="$( \
6644
scanelf --needed --nobanner --recursive /usr/local \
6745
| awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
@@ -71,16 +49,44 @@ RUN set -ex \
7149
)" \
7250
&& apk add --virtual .python-rundeps $runDeps \
7351
&& apk del .build-deps \
74-
&& rm -rf /usr/src/python ~/.cache
52+
\
53+
&& find /usr/local -depth \
54+
\( \
55+
\( -type d -a -name test -o -name tests \) \
56+
-o \
57+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
58+
\) -exec rm -rf '{}' + \
59+
&& rm -rf /usr/src/python
7560

7661
# make some useful symlinks that are expected to exist
7762
RUN cd /usr/local/bin \
78-
&& { [ -e easy_install ] || ln -s easy_install-* easy_install; } \
7963
&& ln -s idle3 idle \
8064
&& ln -s pydoc3 pydoc \
8165
&& ln -s python3 python \
8266
&& ln -s python3-config python-config
8367

68+
# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
69+
ENV PYTHON_PIP_VERSION 9.0.1
70+
71+
RUN set -ex; \
72+
\
73+
wget -O get-pip.py 'https://bootstrap.pypa.io/get-pip.py'; \
74+
\
75+
python get-pip.py \
76+
--disable-pip-version-check \
77+
--no-cache-dir \
78+
"pip==$PYTHON_PIP_VERSION" \
79+
; \
80+
pip --version; \
81+
\
82+
find /usr/local -depth \
83+
\( \
84+
\( -type d -a -name test -o -name tests \) \
85+
-o \
86+
\( -type f -a -name '*.pyc' -o -name '*.pyo' \) \
87+
\) -exec rm -rf '{}' +; \
88+
rm -f get-pip.py
89+
8490
# HACK: Fix for building numpy
8591
# https://github.com/docker-library/python/issues/112#issuecomment-238383259
8692
RUN ln -s /usr/include/locale.h /usr/include/xlocale.h

0 commit comments

Comments
 (0)