Merge remote-tracking branch 'origin/master' into 3860-http-more-immutables

This commit is contained in:
Itamar Turner-Trauring 2022-02-22 13:07:42 -05:00
commit 6dab065e44
15 changed files with 127 additions and 286 deletions

View File

@ -1,7 +1,7 @@
ARG TAG ARG TAG
FROM debian:${TAG} FROM debian:${TAG}
ARG PYTHON_VERSION ARG PYTHON_VERSION
ENV DEBIAN_FRONTEND noninteractive
ENV WHEELHOUSE_PATH /tmp/wheelhouse ENV WHEELHOUSE_PATH /tmp/wheelhouse
ENV VIRTUALENV_PATH /tmp/venv ENV VIRTUALENV_PATH /tmp/venv
# This will get updated by the CircleCI checkout step. # This will get updated by the CircleCI checkout step.

View File

@ -1,5 +1,5 @@
ARG TAG ARG TAG
FROM centos:${TAG} FROM oraclelinux:${TAG}
ARG PYTHON_VERSION ARG PYTHON_VERSION
ENV WHEELHOUSE_PATH /tmp/wheelhouse ENV WHEELHOUSE_PATH /tmp/wheelhouse
@ -13,7 +13,6 @@ RUN yum install --assumeyes \
sudo \ sudo \
make automake gcc gcc-c++ \ make automake gcc gcc-c++ \
python${PYTHON_VERSION} \ python${PYTHON_VERSION} \
python${PYTHON_VERSION}-devel \
libffi-devel \ libffi-devel \
openssl-devel \ openssl-devel \
libyaml \ libyaml \

View File

@ -1,7 +1,7 @@
ARG TAG ARG TAG
FROM ubuntu:${TAG} FROM ubuntu:${TAG}
ARG PYTHON_VERSION ARG PYTHON_VERSION
ENV DEBIAN_FRONTEND noninteractive
ENV WHEELHOUSE_PATH /tmp/wheelhouse ENV WHEELHOUSE_PATH /tmp/wheelhouse
ENV VIRTUALENV_PATH /tmp/venv ENV VIRTUALENV_PATH /tmp/venv
# This will get updated by the CircleCI checkout step. # This will get updated by the CircleCI checkout step.

View File

@ -15,28 +15,20 @@ workflows:
ci: ci:
jobs: jobs:
# Start with jobs testing various platforms. # Start with jobs testing various platforms.
- "debian-9":
{}
- "debian-10": - "debian-10":
{}
- "debian-11":
requires: requires:
- "debian-9" - "debian-10"
- "ubuntu-20-04": - "ubuntu-20-04":
{} {}
- "ubuntu-18-04": - "ubuntu-18-04":
requires: requires:
- "ubuntu-20-04" - "ubuntu-20-04"
- "ubuntu-16-04":
requires:
- "ubuntu-20-04"
- "fedora-29": # Equivalent to RHEL 8; CentOS 8 is dead.
{} - "oraclelinux-8":
- "fedora-28":
requires:
- "fedora-29"
- "centos-8":
{} {}
- "nixos": - "nixos":
@ -47,18 +39,12 @@ workflows:
name: "NixOS 21.11" name: "NixOS 21.11"
nixpkgs: "21.11" nixpkgs: "21.11"
# Test against PyPy 2.7 # Eventually, test against PyPy 3.8
- "pypy27-buster": #- "pypy27-buster":
{} # {}
# Test against Python 3:
- "python37":
{}
# Other assorted tasks and configurations # Other assorted tasks and configurations
- "lint": - "codechecks":
{}
- "codechecks3":
{} {}
- "pyinstaller": - "pyinstaller":
{} {}
@ -74,7 +60,7 @@ workflows:
requires: requires:
# If the unit test suite doesn't pass, don't bother running the # If the unit test suite doesn't pass, don't bother running the
# integration tests. # integration tests.
- "debian-9" - "debian-10"
- "typechecks": - "typechecks":
{} {}
@ -104,24 +90,19 @@ workflows:
# https://app.circleci.com/settings/organization/github/tahoe-lafs/contexts # https://app.circleci.com/settings/organization/github/tahoe-lafs/contexts
- "build-image-debian-10": &DOCKERHUB_CONTEXT - "build-image-debian-10": &DOCKERHUB_CONTEXT
context: "dockerhub-auth" context: "dockerhub-auth"
- "build-image-debian-9": - "build-image-debian-11":
<<: *DOCKERHUB_CONTEXT
- "build-image-ubuntu-16-04":
<<: *DOCKERHUB_CONTEXT <<: *DOCKERHUB_CONTEXT
- "build-image-ubuntu-18-04": - "build-image-ubuntu-18-04":
<<: *DOCKERHUB_CONTEXT <<: *DOCKERHUB_CONTEXT
- "build-image-ubuntu-20-04": - "build-image-ubuntu-20-04":
<<: *DOCKERHUB_CONTEXT <<: *DOCKERHUB_CONTEXT
- "build-image-fedora-28": - "build-image-fedora-35":
<<: *DOCKERHUB_CONTEXT <<: *DOCKERHUB_CONTEXT
- "build-image-fedora-29": - "build-image-oraclelinux-8":
<<: *DOCKERHUB_CONTEXT
- "build-image-centos-8":
<<: *DOCKERHUB_CONTEXT
- "build-image-pypy27-buster":
<<: *DOCKERHUB_CONTEXT
- "build-image-python37-ubuntu":
<<: *DOCKERHUB_CONTEXT <<: *DOCKERHUB_CONTEXT
# Restore later as PyPy38
#- "build-image-pypy27-buster":
# <<: *DOCKERHUB_CONTEXT
jobs: jobs:
@ -147,10 +128,10 @@ jobs:
# Since this job is never scheduled this step is never run so the # Since this job is never scheduled this step is never run so the
# actual value here is irrelevant. # actual value here is irrelevant.
lint: codechecks:
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "circleci/python:2" image: "cimg/python:3.9"
steps: steps:
- "checkout" - "checkout"
@ -165,28 +146,10 @@ jobs:
command: | command: |
~/.local/bin/tox -e codechecks ~/.local/bin/tox -e codechecks
codechecks3:
docker:
- <<: *DOCKERHUB_AUTH
image: "circleci/python:3"
steps:
- "checkout"
- run:
name: "Install tox"
command: |
pip install --user tox
- run:
name: "Static-ish code checks"
command: |
~/.local/bin/tox -e codechecks3
pyinstaller: pyinstaller:
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "circleci/python:2" image: "cimg/python:3.9"
steps: steps:
- "checkout" - "checkout"
@ -209,10 +172,10 @@ jobs:
command: | command: |
dist/Tahoe-LAFS/tahoe --version dist/Tahoe-LAFS/tahoe --version
debian-9: &DEBIAN debian-10: &DEBIAN
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/debian:9-py2.7" image: "tahoelafsci/debian:10-py3.7"
user: "nobody" user: "nobody"
environment: &UTF_8_ENVIRONMENT environment: &UTF_8_ENVIRONMENT
@ -226,7 +189,7 @@ jobs:
# filenames and argv). # filenames and argv).
LANG: "en_US.UTF-8" LANG: "en_US.UTF-8"
# Select a tox environment to run for this job. # Select a tox environment to run for this job.
TAHOE_LAFS_TOX_ENVIRONMENT: "py27" TAHOE_LAFS_TOX_ENVIRONMENT: "py37"
# Additional arguments to pass to tox. # Additional arguments to pass to tox.
TAHOE_LAFS_TOX_ARGS: "" TAHOE_LAFS_TOX_ARGS: ""
# The path in which test artifacts will be placed. # The path in which test artifacts will be placed.
@ -294,29 +257,29 @@ jobs:
/tmp/venv/bin/codecov /tmp/venv/bin/codecov
fi fi
debian-11:
debian-10:
<<: *DEBIAN <<: *DEBIAN
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/debian:10-py2.7" image: "tahoelafsci/debian:11-py3.9"
user: "nobody" user: "nobody"
pypy27-buster:
<<: *DEBIAN
docker:
- <<: *DOCKERHUB_AUTH
image: "tahoelafsci/pypy:buster-py2"
user: "nobody"
environment: environment:
<<: *UTF_8_ENVIRONMENT <<: *UTF_8_ENVIRONMENT
# We don't do coverage since it makes PyPy far too slow: TAHOE_LAFS_TOX_ENVIRONMENT: "py39"
TAHOE_LAFS_TOX_ENVIRONMENT: "pypy27"
# Since we didn't collect it, don't upload it.
UPLOAD_COVERAGE: ""
# Restore later using PyPy3.8
# pypy27-buster:
# <<: *DEBIAN
# docker:
# - <<: *DOCKERHUB_AUTH
# image: "tahoelafsci/pypy:buster-py2"
# user: "nobody"
# environment:
# <<: *UTF_8_ENVIRONMENT
# # We don't do coverage since it makes PyPy far too slow:
# TAHOE_LAFS_TOX_ENVIRONMENT: "pypy27"
# # Since we didn't collect it, don't upload it.
# UPLOAD_COVERAGE: ""
c-locale: c-locale:
<<: *DEBIAN <<: *DEBIAN
@ -364,25 +327,8 @@ jobs:
- run: *SETUP_VIRTUALENV - run: *SETUP_VIRTUALENV
- run: *RUN_TESTS - run: *RUN_TESTS
ubuntu-16-04:
<<: *DEBIAN
docker:
- <<: *DOCKERHUB_AUTH
image: "tahoelafsci/ubuntu:16.04-py2.7"
user: "nobody"
ubuntu-18-04: &UBUNTU_18_04 ubuntu-18-04: &UBUNTU_18_04
<<: *DEBIAN <<: *DEBIAN
docker:
- <<: *DOCKERHUB_AUTH
image: "tahoelafsci/ubuntu:18.04-py2.7"
user: "nobody"
python37:
<<: *UBUNTU_18_04
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/ubuntu:18.04-py3.7" image: "tahoelafsci/ubuntu:18.04-py3.7"
@ -401,17 +347,21 @@ jobs:
<<: *DEBIAN <<: *DEBIAN
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/ubuntu:20.04" image: "tahoelafsci/ubuntu:20.04-py3.9"
user: "nobody" user: "nobody"
environment:
<<: *UTF_8_ENVIRONMENT
TAHOE_LAFS_TOX_ENVIRONMENT: "py39"
oraclelinux-8: &RHEL_DERIV
centos-8: &RHEL_DERIV
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/centos:8-py2" image: "tahoelafsci/oraclelinux:8-py3.8"
user: "nobody" user: "nobody"
environment: *UTF_8_ENVIRONMENT environment:
<<: *UTF_8_ENVIRONMENT
TAHOE_LAFS_TOX_ENVIRONMENT: "py38"
# pip cannot install packages if the working directory is not readable. # pip cannot install packages if the working directory is not readable.
# We want to run a lot of steps as nobody instead of as root. # We want to run a lot of steps as nobody instead of as root.
@ -427,20 +377,11 @@ jobs:
- store_artifacts: *STORE_OTHER_ARTIFACTS - store_artifacts: *STORE_OTHER_ARTIFACTS
- run: *SUBMIT_COVERAGE - run: *SUBMIT_COVERAGE
fedora-35:
fedora-28:
<<: *RHEL_DERIV <<: *RHEL_DERIV
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/fedora:28-py" image: "tahoelafsci/fedora:35-py3"
user: "nobody"
fedora-29:
<<: *RHEL_DERIV
docker:
- <<: *DOCKERHUB_AUTH
image: "tahoelafsci/fedora:29-py"
user: "nobody" user: "nobody"
nixos: nixos:
@ -554,7 +495,7 @@ jobs:
typechecks: typechecks:
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/ubuntu:18.04-py3" image: "tahoelafsci/ubuntu:18.04-py3.7"
steps: steps:
- "checkout" - "checkout"
@ -566,7 +507,7 @@ jobs:
docs: docs:
docker: docker:
- <<: *DOCKERHUB_AUTH - <<: *DOCKERHUB_AUTH
image: "tahoelafsci/ubuntu:18.04-py3" image: "tahoelafsci/ubuntu:18.04-py3.7"
steps: steps:
- "checkout" - "checkout"
@ -589,13 +530,14 @@ jobs:
image: "cimg/base:2022.01" image: "cimg/base:2022.01"
environment: environment:
DISTRO: "tahoelafsci/<DISTRO>:foo-py2" DISTRO: "tahoelafsci/<DISTRO>:foo-py3.9"
TAG: "tahoelafsci/distro:<TAG>-py2" TAG: "tahoelafsci/distro:<TAG>-py3.9"
PYTHON_VERSION: "tahoelafsci/distro:tag-py<PYTHON_VERSION}" PYTHON_VERSION: "tahoelafsci/distro:tag-py<PYTHON_VERSION}"
steps: steps:
- "checkout" - "checkout"
- "setup_remote_docker" - setup_remote_docker:
version: "20.10.11"
- run: - run:
name: "Log in to Dockerhub" name: "Log in to Dockerhub"
command: | command: |
@ -622,39 +564,20 @@ jobs:
environment: environment:
DISTRO: "debian" DISTRO: "debian"
TAG: "10" TAG: "10"
PYTHON_VERSION: "2.7" PYTHON_VERSION: "3.7"
build-image-debian-9: build-image-debian-11:
<<: *BUILD_IMAGE <<: *BUILD_IMAGE
environment: environment:
DISTRO: "debian" DISTRO: "debian"
TAG: "9" TAG: "11"
PYTHON_VERSION: "2.7" PYTHON_VERSION: "3.9"
build-image-ubuntu-16-04:
<<: *BUILD_IMAGE
environment:
DISTRO: "ubuntu"
TAG: "16.04"
PYTHON_VERSION: "2.7"
build-image-ubuntu-18-04: build-image-ubuntu-18-04:
<<: *BUILD_IMAGE <<: *BUILD_IMAGE
environment:
DISTRO: "ubuntu"
TAG: "18.04"
PYTHON_VERSION: "2.7"
build-image-python37-ubuntu:
<<: *BUILD_IMAGE
environment: environment:
DISTRO: "ubuntu" DISTRO: "ubuntu"
TAG: "18.04" TAG: "18.04"
@ -667,43 +590,32 @@ jobs:
environment: environment:
DISTRO: "ubuntu" DISTRO: "ubuntu"
TAG: "20.04" TAG: "20.04"
PYTHON_VERSION: "2.7" PYTHON_VERSION: "3.9"
build-image-centos-8: build-image-oraclelinux-8:
<<: *BUILD_IMAGE <<: *BUILD_IMAGE
environment: environment:
DISTRO: "centos" DISTRO: "oraclelinux"
TAG: "8" TAG: "8"
PYTHON_VERSION: "2" PYTHON_VERSION: "3.8"
build-image-fedora-35:
build-image-fedora-28:
<<: *BUILD_IMAGE <<: *BUILD_IMAGE
environment: environment:
DISTRO: "fedora" DISTRO: "fedora"
TAG: "28" TAG: "35"
# The default on Fedora (this version anyway) is still Python 2. PYTHON_VERSION: "3"
PYTHON_VERSION: ""
# build-image-pypy27-buster:
# <<: *BUILD_IMAGE
build-image-fedora-29: # environment:
<<: *BUILD_IMAGE # DISTRO: "pypy"
# TAG: "buster"
environment: # # We only have Python 2 for PyPy right now so there's no support for
DISTRO: "fedora" # # setting up PyPy 3 in the image building toolchain. This value is just
TAG: "29" # # for constructing the right Docker image tag.
# PYTHON_VERSION: "2"
build-image-pypy27-buster:
<<: *BUILD_IMAGE
environment:
DISTRO: "pypy"
TAG: "buster"
# We only have Python 2 for PyPy right now so there's no support for
# setting up PyPy 3 in the image building toolchain. This value is just
# for constructing the right Docker image tag.
PYTHON_VERSION: "2"

View File

@ -38,14 +38,11 @@ jobs:
- windows-latest - windows-latest
- ubuntu-latest - ubuntu-latest
python-version: python-version:
- 2.7
- 3.7 - 3.7
- 3.8 - 3.8
- 3.9 - 3.9
include: include:
# On macOS don't bother with 3.7-3.8, just to get faster builds. # On macOS don't bother with 3.7-3.8, just to get faster builds.
- os: macos-10.15
python-version: 2.7
- os: macos-latest - os: macos-latest
python-version: 3.9 python-version: 3.9
@ -108,25 +105,6 @@ jobs:
# Action for this, as of Jan 2021 it does not support Python coverage # Action for this, as of Jan 2021 it does not support Python coverage
# files - only lcov files. Therefore, we use coveralls-python, the # files - only lcov files. Therefore, we use coveralls-python, the
# coveralls.io-supplied Python reporter, for this. # coveralls.io-supplied Python reporter, for this.
#
# It is coveralls-python 1.x that has maintained compatibility
# with Python 2, while coveralls-python 3.x is compatible with
# Python 3. Sadly we can't use them both in the same workflow.
#
# The two versions of coveralls-python are somewhat mutually
# incompatible. Mixing these two different versions when
# reporting coverage to coveralls.io will lead to grief, since
# they get job IDs in different fashion. If we use both
# versions of coveralls in the same workflow, the finalizing
# step will be able to mark only part of the jobs as done, and
# the other part will be left hanging, never marked as done: it
# does not matter if we make an API call or `coveralls --finish`
# to indicate that CI has finished running.
#
# So we try to use the newer coveralls-python that is available
# via Python 3 (which is present in GitHub Actions tool cache,
# even when we're running Python 2.7 tests) throughout this
# workflow.
- name: "Report Coverage to Coveralls" - name: "Report Coverage to Coveralls"
run: | run: |
pip3 install --upgrade coveralls==3.0.1 pip3 install --upgrade coveralls==3.0.1
@ -179,13 +157,10 @@ jobs:
- windows-latest - windows-latest
- ubuntu-latest - ubuntu-latest
python-version: python-version:
- 2.7
- 3.7 - 3.7
- 3.9 - 3.9
include: include:
# On macOS don't bother with 3.7, just to get faster builds. # On macOS don't bother with 3.7, just to get faster builds.
- os: macos-10.15
python-version: 2.7
- os: macos-latest - os: macos-latest
python-version: 3.9 python-version: 3.9
@ -201,9 +176,7 @@ jobs:
- name: Install Tor [macOS, ${{ matrix.python-version }} ] - name: Install Tor [macOS, ${{ matrix.python-version }} ]
if: ${{ contains(matrix.os, 'macos') }} if: ${{ contains(matrix.os, 'macos') }}
run: | run: |
brew extract --version 0.4.5.8 tor homebrew/cask brew install tor
brew install tor@0.4.5.8
brew link --overwrite tor@0.4.5.8
- name: Install Tor [Windows] - name: Install Tor [Windows]
if: matrix.os == 'windows-latest' if: matrix.os == 'windows-latest'
@ -242,13 +215,13 @@ jobs:
- name: Display tool versions - name: Display tool versions
run: python misc/build_helpers/show-tool-versions.py run: python misc/build_helpers/show-tool-versions.py
- name: Run "Python 2 integration tests"
if: ${{ matrix.python-version == '2.7' }}
run: tox -e integration
- name: Run "Python 3 integration tests" - name: Run "Python 3 integration tests"
if: ${{ matrix.python-version != '2.7' }} env:
run: tox -e integration3 # On macOS this is necessary to ensure unix socket paths for tor
# aren't too long. On Windows tox won't pass it through so it has no
# effect. On Linux it doesn't make a difference one way or another.
TMPDIR: "/tmp"
run: tox -e integration
- name: Upload eliot.log in case of failure - name: Upload eliot.log in case of failure
uses: actions/upload-artifact@v1 uses: actions/upload-artifact@v1
@ -267,7 +240,7 @@ jobs:
- windows-latest - windows-latest
- ubuntu-latest - ubuntu-latest
python-version: python-version:
- 2.7 - 3.9
steps: steps:

View File

@ -17,7 +17,7 @@ PYTHON=python
export PYTHON export PYTHON
PYFLAKES=flake8 PYFLAKES=flake8
export PYFLAKES export PYFLAKES
VIRTUAL_ENV=./.tox/py27 VIRTUAL_ENV=./.tox/py37
SOURCES=src/allmydata static misc setup.py SOURCES=src/allmydata static misc setup.py
APPNAME=tahoe-lafs APPNAME=tahoe-lafs
TEST_SUITE=allmydata TEST_SUITE=allmydata
@ -35,7 +35,7 @@ test: .tox/create-venvs.log
# Run codechecks first since it takes the least time to report issues early. # Run codechecks first since it takes the least time to report issues early.
tox --develop -e codechecks tox --develop -e codechecks
# Run all the test environments in parallel to reduce run-time # Run all the test environments in parallel to reduce run-time
tox --develop -p auto -e 'py27,py37,pypy27' tox --develop -p auto -e 'py37'
.PHONY: test-venv-coverage .PHONY: test-venv-coverage
## Run all tests with coverage collection and reporting. ## Run all tests with coverage collection and reporting.
test-venv-coverage: test-venv-coverage:
@ -136,7 +136,7 @@ count-lines:
# Here is a list of testing tools that can be run with 'python' from a # Here is a list of testing tools that can be run with 'python' from a
# virtualenv in which Tahoe has been installed. There used to be Makefile # virtualenv in which Tahoe has been installed. There used to be Makefile
# targets for each, but the exact path to a suitable python is now up to the # targets for each, but the exact path to a suitable python is now up to the
# developer. But as a hint, after running 'tox', ./.tox/py27/bin/python will # developer. But as a hint, after running 'tox', ./.tox/py37/bin/python will
# probably work. # probably work.
# src/allmydata/test/bench_dirnode.py # src/allmydata/test/bench_dirnode.py

View File

@ -53,12 +53,11 @@ For more detailed instructions, read `Installing Tahoe-LAFS <docs/Installation/i
Once ``tahoe --version`` works, see `How to Run Tahoe-LAFS <docs/running.rst>`__ to learn how to set up your first Tahoe-LAFS node. Once ``tahoe --version`` works, see `How to Run Tahoe-LAFS <docs/running.rst>`__ to learn how to set up your first Tahoe-LAFS node.
🐍 Python 3 Support 🐍 Python 2
-------------------- -----------
Python 3 support has been introduced starting with Tahoe-LAFS 1.16.0, alongside Python 2. Python 3.7 or later is now required.
System administrators are advised to start running Tahoe on Python 3 and should expect Python 2 support to be dropped in a future version. If you are still using Python 2.7, use Tahoe-LAFS version 1.17.1.
Please, feel free to file issues if you run into bugs while running Tahoe on Python 3.
🤖 Issues 🤖 Issues

View File

@ -122,7 +122,7 @@ they will need to evaluate which contributors' signatures they trust.
- these should all pass: - these should all pass:
- tox -e py27,codechecks,docs,integration - tox -e py37,codechecks,docs,integration
- these can fail (ideally they should not of course): - these can fail (ideally they should not of course):

View File

@ -462,10 +462,8 @@ def chutney(reactor, temp_dir):
) )
pytest_twisted.blockon(proto.done) pytest_twisted.blockon(proto.done)
# XXX: Here we reset Chutney to the last revision known to work # XXX: Here we reset Chutney to a specific revision known to work,
# with Python 2, as a workaround for Chutney moving to Python 3. # since there are no stability guarantees or releases yet.
# When this is no longer necessary, we will have to drop this and
# add '--depth=1' back to the above 'git clone' subprocess.
proto = _DumpOutputProtocol(None) proto = _DumpOutputProtocol(None)
reactor.spawnProcess( reactor.spawnProcess(
proto, proto,
@ -473,7 +471,7 @@ def chutney(reactor, temp_dir):
( (
'git', '-C', chutney_dir, 'git', '-C', chutney_dir,
'reset', '--hard', 'reset', '--hard',
'99bd06c7554b9113af8c0877b6eca4ceb95dcbaa' 'c825cba0bcd813c644c6ac069deeb7347d3200ee'
), ),
env=environ, env=environ,
) )

View File

@ -26,10 +26,10 @@ python run-deprecations.py [--warnings=STDERRFILE] [--package=PYTHONPACKAGE ] CO
class RunPP(protocol.ProcessProtocol): class RunPP(protocol.ProcessProtocol):
def outReceived(self, data): def outReceived(self, data):
self.stdout.write(data) self.stdout.write(data)
sys.stdout.write(data) sys.stdout.write(str(data, sys.stdout.encoding))
def errReceived(self, data): def errReceived(self, data):
self.stderr.write(data) self.stderr.write(data)
sys.stderr.write(data) sys.stderr.write(str(data, sys.stdout.encoding))
def processEnded(self, reason): def processEnded(self, reason):
signal = reason.value.signal signal = reason.value.signal
rc = reason.value.exitCode rc = reason.value.exitCode
@ -100,17 +100,19 @@ def run_command(main):
pp.stdout.seek(0) pp.stdout.seek(0)
for line in pp.stdout.readlines(): for line in pp.stdout.readlines():
line = str(line, sys.stdout.encoding)
if match(line): if match(line):
add(line) # includes newline add(line) # includes newline
pp.stderr.seek(0) pp.stderr.seek(0)
for line in pp.stderr.readlines(): for line in pp.stderr.readlines():
line = str(line, sys.stdout.encoding)
if match(line): if match(line):
add(line) add(line)
if warnings: if warnings:
if config["warnings"]: if config["warnings"]:
with open(config["warnings"], "wb") as f: with open(config["warnings"], "w") as f:
print("".join(warnings), file=f) print("".join(warnings), file=f)
print("ERROR: %d deprecation warnings found" % len(warnings)) print("ERROR: %d deprecation warnings found" % len(warnings))
sys.exit(1) sys.exit(1)

0
newsfragments/3327.minor Normal file
View File

View File

@ -0,0 +1 @@
Python 3.7 or later is now required; Python 2 is no longer supported.

View File

@ -11,7 +11,10 @@ import struct
import sys import sys
if not hasattr(sys, 'real_prefix'): try:
import allmydata
del allmydata
except ImportError:
sys.exit("Please run inside a virtualenv with Tahoe-LAFS installed.") sys.exit("Please run inside a virtualenv with Tahoe-LAFS installed.")

View File

@ -55,8 +55,7 @@ install_requires = [
# * foolscap >= 0.12.6 has an i2p.sam_endpoint() that takes kwargs # * foolscap >= 0.12.6 has an i2p.sam_endpoint() that takes kwargs
# * foolscap 0.13.2 drops i2p support completely # * foolscap 0.13.2 drops i2p support completely
# * foolscap >= 21.7 is necessary for Python 3 with i2p support. # * foolscap >= 21.7 is necessary for Python 3 with i2p support.
"foolscap == 0.13.1 ; python_version < '3.0'", "foolscap >= 21.7.0",
"foolscap >= 21.7.0 ; python_version > '3.0'",
# * cryptography 2.6 introduced some ed25519 APIs we rely on. Note that # * cryptography 2.6 introduced some ed25519 APIs we rely on. Note that
# Twisted[conch] also depends on cryptography and Twisted[tls] # Twisted[conch] also depends on cryptography and Twisted[tls]
@ -106,16 +105,10 @@ install_requires = [
# for 'tahoe invite' and 'tahoe join' # for 'tahoe invite' and 'tahoe join'
"magic-wormhole >= 0.10.2", "magic-wormhole >= 0.10.2",
# Eliot is contemplating dropping Python 2 support. Stick to a version we # We want a new enough version to support custom JSON encoders.
# know works on Python 2.7. "eliot >= 1.13.0",
"eliot ~= 1.7 ; python_version < '3.0'",
# On Python 3, we want a new enough version to support custom JSON encoders.
"eliot >= 1.13.0 ; python_version > '3.0'",
# Pyrsistent 0.17.0 (which we use by way of Eliot) has dropped "pyrsistent",
# Python 2 entirely; stick to the version known to work for us.
"pyrsistent < 0.17.0 ; python_version < '3.0'",
"pyrsistent ; python_version > '3.0'",
# A great way to define types of values. # A great way to define types of values.
"attrs >= 18.2.0", "attrs >= 18.2.0",
@ -135,14 +128,8 @@ install_requires = [
# Linux distribution detection: # Linux distribution detection:
"distro >= 1.4.0", "distro >= 1.4.0",
# Backported configparser for Python 2: # For the RangeMap datastructure. Need 2.0.2 at least for bugfixes.
"configparser ; python_version < '3.0'", "collections-extended >= 2.0.2",
# For the RangeMap datastructure. Need 2.0.2 at least for bugfixes. Python
# 2 doesn't actually need this, since HTTP storage protocol isn't supported
# there, so we just pick whatever version so that code imports.
"collections-extended >= 2.0.2 ; python_version > '3.0'",
"collections-extended ; python_version < '3.0'",
# HTTP server and client # HTTP server and client
"klein", "klein",
@ -201,8 +188,7 @@ trove_classifiers=[
"Natural Language :: English", "Natural Language :: English",
"Programming Language :: C", "Programming Language :: C",
"Programming Language :: Python", "Programming Language :: Python",
"Programming Language :: Python :: 2", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 2.7",
"Topic :: Utilities", "Topic :: Utilities",
"Topic :: System :: Systems Administration", "Topic :: System :: Systems Administration",
"Topic :: System :: Filesystems", "Topic :: System :: Filesystems",
@ -229,7 +215,7 @@ def run_command(args, cwd=None):
use_shell = sys.platform == "win32" use_shell = sys.platform == "win32"
try: try:
p = subprocess.Popen(args, stdout=subprocess.PIPE, cwd=cwd, shell=use_shell) p = subprocess.Popen(args, stdout=subprocess.PIPE, cwd=cwd, shell=use_shell)
except EnvironmentError as e: # if this gives a SyntaxError, note that Tahoe-LAFS requires Python 2.7+ except EnvironmentError as e: # if this gives a SyntaxError, note that Tahoe-LAFS requires Python 3.7+
print("Warning: unable to run %r." % (" ".join(args),)) print("Warning: unable to run %r." % (" ".join(args),))
print(e) print(e)
return None return None
@ -380,8 +366,8 @@ setup(name="tahoe-lafs", # also set in __init__.py
package_dir = {'':'src'}, package_dir = {'':'src'},
packages=find_packages('src') + ['allmydata.test.plugins'], packages=find_packages('src') + ['allmydata.test.plugins'],
classifiers=trove_classifiers, classifiers=trove_classifiers,
# We support Python 2.7, and Python 3.7 or later. # We support Python 3.7 or later. 3.10 is not supported quite yet.
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*", python_requires=">=3.7, <3.10",
install_requires=install_requires, install_requires=install_requires,
extras_require={ extras_require={
# Duplicate the Twisted pywin32 dependency here. See # Duplicate the Twisted pywin32 dependency here. See
@ -400,10 +386,6 @@ setup(name="tahoe-lafs", # also set in __init__.py
"tox", "tox",
"pytest", "pytest",
"pytest-twisted", "pytest-twisted",
# XXX: decorator isn't a direct dependency, but pytest-twisted
# depends on decorator, and decorator 5.x isn't compatible with
# Python 2.7.
"decorator < 5",
"hypothesis >= 3.6.1", "hypothesis >= 3.6.1",
"towncrier", "towncrier",
"testtools", "testtools",

48
tox.ini
View File

@ -7,8 +7,7 @@
# the tox-gh-actions package. # the tox-gh-actions package.
[gh-actions] [gh-actions]
python = python =
2.7: py27-coverage,codechecks 3.7: py37-coverage,typechecks,codechecks
3.7: py37-coverage,typechecks,codechecks3
3.8: py38-coverage 3.8: py38-coverage
3.9: py39-coverage 3.9: py39-coverage
pypy-3.7: pypy3 pypy-3.7: pypy3
@ -17,7 +16,7 @@ python =
twisted = 1 twisted = 1
[tox] [tox]
envlist = typechecks,codechecks,codechecks3,py{27,37,38,39}-{coverage},pypy27,pypy3,integration,integration3 envlist = typechecks,codechecks,py{37,38,39}-{coverage},pypy27,pypy3,integration
minversion = 2.4 minversion = 2.4
[testenv] [testenv]
@ -35,12 +34,10 @@ deps =
# happening at the time. The versions selected here are just the current # happening at the time. The versions selected here are just the current
# versions at the time. Bumping them to keep up with future releases is # versions at the time. Bumping them to keep up with future releases is
# fine as long as those releases are known to actually work. # fine as long as those releases are known to actually work.
# pip==22.0.3
# For now these are versions that support Python 2. setuptools==60.9.1
pip==20.3.4 wheel==0.37.1
setuptools==44.1.1 subunitreporter==22.2.0
wheel==0.36.2
subunitreporter==19.3.2
# As an exception, we don't pin certifi because it contains CA # As an exception, we don't pin certifi because it contains CA
# certificates which necessarily change over time. Pinning this is # certificates which necessarily change over time. Pinning this is
# guaranteed to cause things to break eventually as old certificates # guaranteed to cause things to break eventually as old certificates
@ -89,40 +86,20 @@ commands =
coverage: coverage report coverage: coverage report
[testenv:integration] [testenv:integration]
setenv =
COVERAGE_PROCESS_START=.coveragerc
commands =
# NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures'
py.test --timeout=1800 --coverage -v {posargs:integration}
coverage combine
coverage report
[testenv:integration3]
basepython = python3 basepython = python3
platform = mylinux: linux
mymacos: darwin
mywindows: win32
setenv = setenv =
COVERAGE_PROCESS_START=.coveragerc COVERAGE_PROCESS_START=.coveragerc
commands = commands =
python --version
# NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures' # NOTE: 'run with "py.test --keep-tempdir -s -v integration/" to debug failures'
py.test --timeout=1800 --coverage -v {posargs:integration} py.test --timeout=1800 --coverage -v {posargs:integration}
coverage combine coverage combine
coverage report coverage report
# Once 2.7 is dropped, this can be removed. It just does flake8 with Python 2
# since that can give different results than flake8 on Python 3.
[testenv:codechecks] [testenv:codechecks]
basepython = python2.7
setenv =
# If no positional arguments are given, try to run the checks on the
# entire codebase, including various pieces of supporting code.
DEFAULT_FILES=src integration static misc setup.py
commands =
flake8 {posargs:{env:DEFAULT_FILES}}
[testenv:codechecks3]
basepython = python3 basepython = python3
deps = deps =
# Newer versions of PyLint have buggy configuration # Newer versions of PyLint have buggy configuration
@ -224,16 +201,11 @@ commands =
sphinx-build -W -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html sphinx-build -W -b html -d {toxinidir}/docs/_build/doctrees {toxinidir}/docs {toxinidir}/docs/_build/html
[testenv:pyinstaller] [testenv:pyinstaller]
# We override this to pass --no-use-pep517 because pyinstaller (3.4, at least)
# is broken when this feature is enabled.
install_command = python -m pip install --no-use-pep517 {opts} {packages}
extras = extras =
deps = deps =
{[testenv]deps} {[testenv]deps}
packaging packaging
# PyInstaller 4.0 drops Python 2 support. When we finish porting to pyinstaller
# Python 3 we can reconsider this constraint.
pyinstaller < 4.0
pefile ; platform_system == "Windows" pefile ; platform_system == "Windows"
# Setting PYTHONHASHSEED to a known value assists with reproducible builds. # Setting PYTHONHASHSEED to a known value assists with reproducible builds.
# See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build # See https://pyinstaller.readthedocs.io/en/stable/advanced-topics.html#creating-a-reproducible-build