Skip to content

Commit

Permalink
Add support for Python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
ps-jay committed May 10, 2022
1 parent 1d1402b commit e040914
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 5 deletions.
61 changes: 57 additions & 4 deletions Dockerfile.testing
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,19 @@ FROM python:3.9 AS py39

RUN echo "${PYTHON_VERSION}" > /tmp/py39-latest

##------------------------------------------------------------------------------
FROM python:3.10 AS py310

RUN echo "${PYTHON_VERSION}" > /tmp/py310-latest

##------------------------------------------------------------------------------
FROM centos:7 AS base

# EPEL needed for openssl 1.1.x
RUN yum clean all \
&& yum update -y \
&& yum install -y \
epel-release \
nmap-ncat \
unixODBC \
&& yum clean all \
Expand All @@ -42,6 +49,15 @@ RUN yum-builddep -y python3
RUN yum install -y \
unixODBC-devel

# Python >= 3.10 needs openssl 1.1.x
RUN yum install -y \
openssl11-devel

RUN mkdir /usr/local/openssl11 \
&& cd /usr/local/openssl11 \
&& ln -s /usr/lib64/openssl11 lib \
&& ln -s /usr/include/openssl11 include

RUN mkdir /src

##------------------------------------------------------------------------------
Expand All @@ -61,7 +77,7 @@ RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& cd "/tmp/Python-${PYTHON_VERSION}" \
&& ./configure --prefix=/opt/py${py_ver} \
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
&& make install

USER root
Expand Down Expand Up @@ -94,7 +110,7 @@ RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& cd "/tmp/Python-${PYTHON_VERSION}" \
&& ./configure --prefix=/opt/py${py_ver} \
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
&& make install

USER root
Expand Down Expand Up @@ -127,7 +143,40 @@ RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& cd "/tmp/Python-${PYTHON_VERSION}" \
&& ./configure --prefix=/opt/py${py_ver} \
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
&& make install

USER root
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
RUN pip3 install tox
USER ${nonroot_uid}

ENV HOME=/src
ENV PATH=/opt/py${py_ver}/bin:"${PATH}"
WORKDIR /src

ADD django_informixdb/ /src/django_informixdb/
ADD README.rst setup.* tox.ini /src/
RUN tox -e "$(tox --listenvs | grep py${py_ver} | tr '\n' ',')" --notest # prep venvs

##------------------------------------------------------------------------------
FROM builder-base AS builder-py310
ARG py_ver=310
ARG nonroot_uid
COPY --from=py310 /tmp/py${py_ver}-latest /tmp/

RUN mkdir /opt/py${py_ver} && chown -R ${nonroot_uid} /opt/py${py_ver} /src
USER ${nonroot_uid}
WORKDIR /tmp

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& curl --silent --show-error --fail --location \
"https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz" \
| tar -xz

RUN export PYTHON_VERSION="$(cat /tmp/py${py_ver}-latest)" \
&& cd "/tmp/Python-${PYTHON_VERSION}" \
&& ./configure --prefix=/opt/py${py_ver} --with-openssl=/usr/local/openssl11 \
&& make install

USER root
Expand Down Expand Up @@ -167,6 +216,10 @@ COPY --from=builder-py39 /opt/py39/ /opt/py39/
COPY --from=builder-py39 /src/.tox/ /src/.tox/
COPY --from=builder-py39 /src/.cache/ /src/.cache/

COPY --from=builder-py310 /opt/py310/ /opt/py310/
COPY --from=builder-py310 /src/.tox/ /src/.tox/
COPY --from=builder-py310 /src/.cache/ /src/.cache/

ADD wait-for-deps.sh /usr/local/bin
RUN chmod a+rx /usr/local/bin/wait-for-deps.sh

Expand All @@ -175,7 +228,7 @@ ADD --chown=${nonroot_uid} django_informixdb/ /src/django_informixdb/
ADD --chown=${nonroot_uid} test/ /src/test/
RUN chown ${nonroot_uid} /src

ENV PATH=/opt/py39/bin:/opt/py38/bin:/opt/py37/bin:"${PATH}"
ENV PATH=/opt/py310/bin:/opt/py39/bin:/opt/py38/bin:/opt/py37/bin:"${PATH}"
RUN pip3 --no-cache-dir install tox

USER ${nonroot_uid}
Expand Down
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,10 @@ Requirements: Docker 19.03.2 or newer and Docker Compose 1.24.1 or newer.
Release History
---------------

Version 1.11.2

- Begin support for Python 3.10

Version 1.11.1

- Convert from TravisCI to GitHub Actions
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
],
keywords='django informix',
packages=find_packages(exclude=['contrib', 'docs', 'tests']),
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py37-dj3,py38-dj3,py39-dj3,py38-dj4,py39-dj4
envlist = py37-dj3,py38-dj3,py39-dj3,py310-dj3,py38-dj4,py39-dj4,py310-dj4

[testenv]
deps =
Expand Down

0 comments on commit e040914

Please sign in to comment.