diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..fb7f5064 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,46 @@ +name: CI + +on: + pull_request: + push: + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + test: + strategy: + fail-fast: false + matrix: + versions: + - python: "2.6" + - python: "2.7" + - python: "3.3" + - python: "3.4" + - python: "3.5" + - python: "3.6" + - python: "3.7" + - python: "3.8" + - python: "3.9" + + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - if: ${{ matrix.versions.python != '2.6' }} + run: | + docker build \ + . \ + --build-arg PYTHON_VERSION=${{ matrix.versions.python }} \ + -t jmadler/python-future-builder:${{ matrix.versions.python }} + - if: ${{ matrix.versions.python == '2.6' }} + run: | + docker build \ + . \ + -f 2.6.Dockerfile \ + -t jmadler/python-future-builder:${{ matrix.versions.python }} + - run: | + docker run \ + -e PYTHON_VERSION=${{ matrix.versions.python }} \ + jmadler/python-future-builder:${{ matrix.versions.python }} \ + /root/python-future/test.sh \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 3fe6a983..00000000 --- a/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: generic - -services: - - docker - -before_script: - - docker pull jmadler/python-future-builder:latest - -script: - - ./build.sh - - ./lint.sh diff --git a/2.6.Dockerfile b/2.6.Dockerfile new file mode 100644 index 00000000..efaf3809 --- /dev/null +++ b/2.6.Dockerfile @@ -0,0 +1,26 @@ +FROM mrupgrade/deadsnakes:2.6 + +RUN mkdir -p ~/.pip/ && echo '[global] \n\ +trusted-host = pypi.python.org\n\ + pypi.org\n\ + files.pythonhosted.org\n\ +' >> ~/.pip/pip.conf + +RUN apt-get update && \ + apt-get install -y curl + +RUN mkdir -p /root/pip && \ + cd /root/pip && \ + curl -O https://files.pythonhosted.org/packages/8a/e9/8468cd68b582b06ef554be0b96b59f59779627131aad48f8a5bce4b13450/wheel-0.29.0-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/31/77/3781f65cafe55480b56914def99022a5d2965a4bb269655c89ef2f1de3cd/importlib-1.0.4.zip && \ + curl -O https://files.pythonhosted.org/packages/ef/41/d8a61f1b2ba308e96b36106e95024977e30129355fd12087f23e4b9852a1/pytest-3.2.5-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/f2/94/3af39d34be01a24a6e65433d19e107099374224905f1e0cc6bbe1fd22a2f/argparse-1.4.0-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/72/20/7f0f433060a962200b7272b8c12ba90ef5b903e218174301d0abfd523813/unittest2-1.1.0-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/53/67/9620edf7803ab867b175e4fd23c7b8bd8eba11cb761514dcd2e726ef07da/py-1.4.34-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/53/25/ef88e8e45db141faa9598fbf7ad0062df8f50f881a36ed6a0073e1572126/ordereddict-1.1.tar.gz && \ + curl -O https://files.pythonhosted.org/packages/17/0a/6ac05a3723017a967193456a2efa0aa9ac4b51456891af1e2353bb9de21e/traceback2-1.4.0-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/65/26/32b8464df2a97e6dd1b656ed26b2c194606c16fe163c695a992b36c11cdf/six-1.13.0-py2.py3-none-any.whl && \ + curl -O https://files.pythonhosted.org/packages/c7/a3/c5da2a44c85bfbb6eebcfc1dde24933f8704441b98fdde6528f4831757a6/linecache2-1.0.0-py2.py3-none-any.whl + +WORKDIR /root/python-future +ADD . /root/python-future \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index cf9ffd3c..c859757f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,3 +1,7 @@ -FROM quay.io/pypa/manylinux1_x86_64 +ARG PYTHON_VERSION +FROM python:${PYTHON_VERSION}-slim + +ENV LC_ALL=C.UTF-8 + WORKDIR /root/python-future ADD . /root/python-future diff --git a/README.rst b/README.rst index 1ab43e53..cce7605c 100644 --- a/README.rst +++ b/README.rst @@ -3,8 +3,8 @@ Overview: Easy, clean, reliable Python 2/3 compatibility ======================================================== -.. image:: https://travis-ci.org/PythonCharmers/python-future.svg?branch=master - :target: https://travis-ci.org/PythonCharmers/python-future +.. image:: https://github.com/PythonCharmers/python-future/actions/workflows/ci.yml/badge.svg?branch=master + :target: https://github.com/PythonCharmers/python-future/actions/workflows/ci.yml?query=branch%3Amaster .. image:: https://readthedocs.org/projects/python-future/badge/?version=latest :target: https://python-future.readthedocs.io/en/latest/?badge=latest diff --git a/build.sh b/build.sh deleted file mode 100755 index d4b92d9a..00000000 --- a/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# XXX: TODO: we should make this include -e once tests pass -set -xu - -DOCKER_IMAGE=jmadler/python-future-builder -# XXX: TODO: Perhaps this version shouldn't be hardcoded -version=0.18.4 - -docker build . -t "$DOCKER_IMAGE" -#docker push "$DOCKER_IMAGE:latest" - -for i in cp27-cp27m cp35-cp35m cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39; do - docker run -ti -v "$(realpath dist)":/root/python-future/dist "$DOCKER_IMAGE" /root/python-future/setup.sh "$version" $(basename $i) -done - -python setup.py sdist -python setup.py clean -echo You may now run: "twine upload dist/*" diff --git a/lint.sh b/lint.sh deleted file mode 100755 index b3c41cd4..00000000 --- a/lint.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# TODO: Run under Python 2.7 and 3.7 -flake8 . --count --exit-zero --select=E901,E999,F821,F822,F823 --show-source --statistics || true -flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics || true diff --git a/setup.sh b/setup.sh deleted file mode 100755 index fa89d431..00000000 --- a/setup.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -ex - -version=$1 -pytag=$2 - -if [ "$pytag" = 'py33' ]; then - pip3 install virtualenv==16.2.0 -fi - -. /root/"$pytag"/bin/activate - -if [ "$pytag" = 'py26' ]; then - pip install importlib -fi -pip install pytest unittest2 -python setup.py bdist_wheel --python-tag="$pytag" -pip install "dist/future-$version-$pytag-none-any.whl" -# Ignore test failures for now -pytest tests/ || true diff --git a/src/future/moves/_dummy_thread.py b/src/future/moves/_dummy_thread.py index 96cf99e1..6633f42e 100644 --- a/src/future/moves/_dummy_thread.py +++ b/src/future/moves/_dummy_thread.py @@ -1,13 +1,13 @@ from __future__ import absolute_import -from future.utils import PY3 +from future.utils import PY3, PY39_PLUS -if PY3: + +if PY39_PLUS: # _dummy_thread and dummy_threading modules were both deprecated in # Python 3.7 and removed in Python 3.9 - try: + from _thread import * +elif PY3: from _dummy_thread import * - except ImportError: - from _thread import * else: __future_module__ = True from dummy_thread import * diff --git a/test.sh b/test.sh new file mode 100755 index 00000000..d45e98d3 --- /dev/null +++ b/test.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -exo pipefail + +python --version + +if [ -e "/root/pip" ] +then + pip install /root/pip/*.zip /root/pip/*.whl /root/pip/*tar.gz +else + pip install pytest unittest2 +fi + +pytag="py${PYTHON_VERSION//./}" + +python setup.py bdist_wheel --python-tag="${pytag}" +pip install dist/future-*-${pytag}-none-any.whl +pytest tests/