Skip to content

Update 3.6 to 3.6.0b3 and refactor update.sh to handle pre-releases in a saner manner #157

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ language: bash
services: docker

env:
- VERSION=3.6 VARIANT=
- VERSION=3.6 VARIANT=slim
- VERSION=3.6 VARIANT=alpine
- VERSION=3.6-rc VARIANT=
- VERSION=3.6-rc VARIANT=slim
- VERSION=3.6-rc VARIANT=alpine
- VERSION=3.5 VARIANT=
- VERSION=3.5 VARIANT=slim
- VERSION=3.5 VARIANT=alpine
Expand Down
8 changes: 7 additions & 1 deletion 3.6/Dockerfile → 3.6-rc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM buildpack-deps:jessie

# ensure local python is preferred over distribution python
Expand All @@ -14,7 +20,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0b2
ENV PYTHON_VERSION 3.6.0b3

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2
Expand Down
8 changes: 7 additions & 1 deletion 3.6/alpine/Dockerfile → 3.6-rc/alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM alpine:3.4

# ensure local python is preferred over distribution python
Expand All @@ -12,7 +18,7 @@ ENV LANG C.UTF-8
RUN apk add --no-cache ca-certificates

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0b2
ENV PYTHON_VERSION 3.6.0b3

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2
Expand Down
8 changes: 7 additions & 1 deletion 3.6/onbuild/Dockerfile → 3.6-rc/onbuild/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
FROM python:3.6
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM python:3.6-rc

RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
Expand Down
8 changes: 7 additions & 1 deletion 3.6/slim/Dockerfile → 3.6-rc/slim/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM debian:jessie

# ensure local python is preferred over distribution python
Expand All @@ -16,7 +22,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV GPG_KEY 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D
ENV PYTHON_VERSION 3.6.0b2
ENV PYTHON_VERSION 3.6.0b3

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
ENV PYTHON_PIP_VERSION 8.1.2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#

FROM microsoft/windowsservercore

SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"]

ENV PYTHON_VERSION 3.6.0b2
ENV PYTHON_VERSION 3.6.0b3
ENV PYTHON_RELEASE 3.6.0

# if this is called "PIP_VERSION", pip explodes with "ValueError: invalid truth value '<VERSION>'"
Expand Down
1 change: 1 addition & 0 deletions generate-stackbrew-library.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
set -eu

declare -A aliases=(
[3.6-rc]='rc'
[3.5]='3 latest'
[2.7]='2'
)
Expand Down
25 changes: 19 additions & 6 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,31 @@ generated_warning() {

travisEnv=
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 -fsSL '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 way to handle RCs than just filtering them out
rcGrepV='-v'
rcVersion="${version%-rc}"
if [ "$rcVersion" != "$version" ]; then
rcGrepV=
fi

possibles=( $(curl -fsSL 'https://www.python.org/ftp/python/' | grep '<a href="'"$rcVersion." | sed -r 's!.*<a href="([^"/]+)/?".*!\1!' | sort -rV) )
fullVersion=
for possible in "${possibles[@]}"; do
possibleVersions=( $(curl -fsSL "https://www.python.org/ftp/python/$possible/" | grep '<a href="Python-'"$rcVersion"'.*\.tar\.xz"' | sed -r 's!.*<a href="Python-([^"/]+)\.tar\.xz".*!\1!' | grep $rcGrepV -E -- '[a-zA-Z]+' | sort -rV) )
if [ "${#possibleVersions[@]}" -gt 0 ]; then
fullVersion="${possibleVersions[0]}"
break
fi
done

if [ -z "$fullVersion" ]; then
{
echo
echo
echo " warning: cannot find $version (alpha/beta/rc?)"
echo " error: cannot find $version (alpha/beta/rc?)"
echo
echo
} >&2
exit 1
else
if [[ "$version" != 2.* ]]; then
for variant in \
Expand Down Expand Up @@ -86,7 +99,7 @@ for version in "${versions[@]}"; do
(
set -x
sed -ri \
-e 's/^(ENV GPG_KEY) .*/\1 '"${gpgKeys[$version]}"'/' \
-e 's/^(ENV GPG_KEY) .*/\1 '"${gpgKeys[$rcVersion]}"'/' \
-e 's/^(ENV PYTHON_VERSION) .*/\1 '"$fullVersion"'/' \
-e 's/^(ENV PYTHON_RELEASE) .*/\1 '"${fullVersion%%[a-z]*}"'/' \
-e 's/^(ENV PYTHON_PIP_VERSION) .*/\1 '"$pipVersion"'/' \
Expand Down