diff --git a/.gitignore b/.gitignore index 3b7bce98..01c37c9c 100644 --- a/.gitignore +++ b/.gitignore @@ -21,6 +21,8 @@ develop-eggs .installed.cfg lib lib64 +MANIFEST +MANIFEST.in # Backup files *.bak diff --git a/.travis.yml b/.travis.yml index 1be7fac8..d3a8b5ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,46 +1,11 @@ -sudo: false -language: python -cache: pip +language: generic - -matrix: - include: - - python: 2.6 - env: TOXENV=py26 - dist: trusty - - python: 2.7 - env: TOXENV=py27 - - python: 3.3 - env: TOXENV=py33 - dist: trusty - sudo: false - - python: 3.4 - env: TOXENV=py34 - - python: 3.5 - env: TOXENV=py35 - - python: 3.6 - env: TOXENV=py36 - - python: 3.7 - env: TOXENV=py37 - dist: xenial # required for Python 3.7 (travis-ci/travis-ci#9069) - sudo: required # required for Python 3.7 (travis-ci/travis-ci#9069) - -install: - - pip install typing==3.7.4.1 # required for Python 3.3 - - pip install tox==2.9.1 - - pip install virtualenv==15.2.0 - - pip install py==1.4.30 - - pip install pluggy==0.5.2 +services: + - docker before_script: - # Run flake8 tests only on Python 2.7 and 3.7... - # 1) stop the build if there are Python syntax errors or undefined names - # 2) exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - - if [[ $TRAVIS_PYTHON_VERSION == *.7 ]]; then - pip install flake8; - flake8 . --count --exit-zero --select=E901,E999,F821,F822,F823 --show-source --statistics; - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics; - fi + - docker pull jmadler/python-future-builder:latest script: - - tox + - ./lint.sh + - ./build.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..5ed3387f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +FROM debian:9 +# This docker image has a copy of a wide array of Pythons installed +RUN apt-get update +RUN apt-get install --yes --no-install-recommends make build-essential zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libffi-dev liblzma-dev libssl1.0-dev +RUN apt-get install --yes git vim +RUN apt-get install --yes python3-pip +ENV PYENV_ROOT=/opt/pyenv +RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash +RUN echo export PATH="/opt/pyenv/bin:$PATH" >> ~/.bashrc +RUN echo 'eval "$(pyenv init -)"' >> ~/.bashrc +RUN echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc +# venv 15.2.0 is the last to support Python 2.6. +RUN pip3 install virtualenv==15.2.0 +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 2.6.9 +RUN virtualenv /root/py26 --python /opt/pyenv/versions/2.6.9/bin/python +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.3.7 +RUN virtualenv /root/py33 --python /opt/pyenv/versions/3.3.7/bin/python +RUN pip3 install virtualenv==20.0.21 +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.4.10 +RUN virtualenv /root/py34 --python /opt/pyenv/versions/3.4.10/bin/python +RUN apt-get install --yes libssl-dev libxmlsec1-dev +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 2.7.18 +RUN virtualenv /root/py27 --python /opt/pyenv/versions/2.7.18/bin/python +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.5.9 +RUN virtualenv /root/py35 --python /opt/pyenv/versions/3.5.9/bin/python +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.6.10 +RUN virtualenv /root/py36 --python /opt/pyenv/versions/3.6.10/bin/python +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.7.7 +RUN virtualenv /root/py37 --python /opt/pyenv/versions/3.7.7/bin/python +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.8.3 +RUN virtualenv /root/py38 --python /opt/pyenv/versions/3.8.3/bin/python +RUN PATH=/opt/pyenv/bin:$PATH pyenv install 3.9.0 +RUN virtualenv /root/py39 --python /opt/pyenv/versions/3.9.0/bin/python +RUN ln -s /usr/bin/python3 /usr/bin/python +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 +WORKDIR /root/python-future +ADD . /root/python-future diff --git a/TESTING.txt b/TESTING.txt index 0e9b96a3..b2ad5c65 100644 --- a/TESTING.txt +++ b/TESTING.txt @@ -1,8 +1,6 @@ -Currently the tests are passing on OS X and Linux on Python 2.7 and 3.4. +A docker image, python-future-builder, is used to do testing and building. The test suite can be run with: -The test suite can be run with: - - $ tox + $ bash build.sh which tests the module under a number of different python versions, where available, or with: @@ -10,4 +8,4 @@ which tests the module under a number of different python versions, where availa To execute a single test: - $ pytest -k test_chained_exceptions_stacktrace \ No newline at end of file + $ pytest -k test_chained_exceptions_stacktrace diff --git a/build.sh b/build.sh new file mode 100755 index 00000000..9dbba568 --- /dev/null +++ b/build.sh @@ -0,0 +1,14 @@ +# XXX: TODO: we should make this include -e once tests pass +set -xuo pipefail + +docker build . -t jmadler/python-future-builder + +version=0.18.2 + +for i in py26 py27 py33 py34 py35 py36 py37 py38 py39; do + docker run -ti -v $(realpath dist):/root/python-future/dist python-future-builder /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 new file mode 100644 index 00000000..234b3f14 --- /dev/null +++ b/lint.sh @@ -0,0 +1,3 @@ +# Run under Python 2.7 and 3.7 +flake8 . --count --exit-zero --select=E901,E999,F821,F822,F823 --show-source --statistics +flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics diff --git a/setup.sh b/setup.sh new file mode 100755 index 00000000..8e8dc150 --- /dev/null +++ b/setup.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -exo pipefail + +version=$1 +pytag=$2 + +if [ $pytag = 'py33' ]; then + pip3 install virtualenv==16.2.0 +fi + +source /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 +pytest tests/ diff --git a/tox.ini b/tox.ini deleted file mode 100644 index bc3300ab..00000000 --- a/tox.ini +++ /dev/null @@ -1,16 +0,0 @@ -[tox] -envlist = - py{26,27,33,34,35,36,37}, - docs - -[testenv] -deps = - pytest - unittest2 - py26: importlib -commands = pytest {posargs} - -[testenv:docs] -deps = - -rdocs/requirements.txt -commands = sphinx-build docs build