forked from docker-library/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·27 lines (23 loc) · 1.04 KB
/
update.sh
File metadata and controls
executable file
·27 lines (23 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
set -e
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
if [ ${#versions[@]} -eq 0 ]; then
versions=( */ )
fi
versions=( "${versions[@]%/}" )
pipVersion="$(curl -sSL 'https://pypi.python.org/pypi/pip/json' | awk -F '"' '$2 == "version" { print $4 }')"
for version in "${versions[@]}"; do
# <span class="release-number"><a href="/downloads/release/python-278/">Python 2.7.8</a></span>
# <span class="release-number"><a href="/downloads/release/python-341/">Python 3.4.1</a></span>
fullVersion="$(curl -sSL 'https://www.python.org/downloads/' | awk -F 'Python |</a>' '/<span class="release-number"><a[^>]+>Python '"$version"'./ { print $2 }' | grep -v 'rc' | sort -V | tail -1)"
# TODO figure out a better want to handle RCs than just filtering them out wholesale
(
set -x
sed -ri '
s/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/;
s/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/;
' "$version"/{,slim/,wheezy/}Dockerfile
sed -ri 's/^(FROM python):.*/\1:'"$version"'/' "$version/onbuild/Dockerfile"
)
done