Showing 1,318 changed files with 61,536 additions and 47,251 deletions.
3 changes: 2 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ source = twisted

[paths]
source=
twisted
src/twisted
build/*/lib/python*/site-packages/twisted
build/*/Lib/site-packages/twisted
build/pypy*/site-packages/twisted

[report]
Expand Down
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## Remove this paragraph

Please have a look at our developer documentation before submitting your Pull Request.

https://twistedmatrix.com/trac/wiki/TwistedDevelopment#SubmittingaPatch

## Contributor Checklist:

* [ ] There is an associated ticket in Trac. Create a new one at https://twistedmatrix.com/trac/newticket
* [ ] I have created a newsfragment in src/twisted/newsfragments/ (see: https://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles )
* [ ] I have updated the automated tests.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
*.egg-info/
.eggs/
*.o
*.py[co]
*.so
*.DS_Store
_trial_temp*/
build/
dropin.cache
Expand All @@ -14,3 +16,4 @@ htmlcov/
*~
*.lock
apidocs/
.automat_visualize
71 changes: 59 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,77 @@
#
# This is the Travis-CI configuration.
#
# The actual dependency installation and test execution is done via tox as a
# way to share the same process between Travis-CI and Buildbot.
#
language: python
sudo: false


# Only run tests on push on a few branches.
# Test on PR should be execute for all branches and forks.
branches:
only:
- trunk
- trunk
- /^release-.*$/


env:
global:
- TRIAL_REPORTER=text


matrix:
include:
- python: 2.7
env: TOXENV=py27-alldeps-withcov-posix,codecov-publish
- python: 2.7
env: TOXENV=py27-nodeps-withcov-posix,codecov-publish
- python: 3.3
env: TOXENV=py33-alldeps-withcov-posix,codecov-publish
- python: 3.4
env: TOXENV=py34-alldeps-withcov-posix,codecov-publish
- python: 3.5
env: TOXENV=py35-alldeps-withcov-posix,codecov-publish
- python: 3.6
env: TOXENV=py36-alldeps-withcov-posix,codecov-publish
# For now all non-trial tests are in a single job to reduce the time spent
# on starting separate jobs.
- python: 2.7
env: TOXENV=narrativedocs,apidocs,pyflakes,newsfragment,manifest-checker
- python: 3.6
env: TOXENV=pyflakes3
# Twistedchecker is running as a separate job so that we can ignore if it
# fails. This needs to be on Python 3.5 for the moment, due to astroid
# changes.
- python: 3.5
env: TOXENV=txchecker-travis-required
- python: 3.5
env: TOXENV=txchecker-travis-all
# We need a builder without IPv6. This is going to be slower than all the
# others, but that's ok.
- python: 3.6
env: TOXENV=py36-alldeps-withcov-posix,codecov-publish DISABLE_IPV6=yes
sudo: true
allow_failures:
- env: TOXENV=txchecker-travis-all


addons:
apt:
packages:
- libssl-dev
- libssl1.0.0


cache:
directories:
- $HOME/.cache/pip
- $HOME/.pyenv

python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"

env:
global:
- TRIAL_REPORTER=text

install:
- pip install tox tox-travis
- ./.travis/install.sh tox


# FIXME: https://twistedmatrix.com/trac/ticket/8373
Expand All @@ -37,5 +82,7 @@ before_script:
- git remote set-branches --add origin trunk
- git fetch origin trunk


# Run tox from the created virtualenv.
script:
- tox
- ./.travis/run.sh
20 changes: 20 additions & 0 deletions .travis/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash
set -e
set -x

# We need to test on machines that do not have IPv6, because this is a
# supported configuration and we've broken our tests for this in the past.
# See https://twistedmatrix.com/trac/ticket/9144
if [[ "${DISABLE_IPV6}" = "yes" ]]; then
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
fi

# Temporary workaround for https://github.com/pypa/setuptools/issues/776;
# install (and thereby cache a built wheel of) cryptography. (NB: We're
# already using the same Python version in this venv as in the test env,
# thanks to travis.yml).
pip install -U pip 'setuptools<26'
pip install cryptography

pip install $@
17 changes: 17 additions & 0 deletions .travis/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e
set -x

if [[ "$(uname -s)" == "Darwin" ]]; then
# Initialize the virtualenv created at install time.
source ~/.venv/bin/activate

if [[ "${TOXENV}" == "py35-alldeps-withcov-macos,codecov-publish" ]]; then
# Add pyenv path
PYENV_ROOT="$HOME/.pyenv";
PATH="$PYENV_ROOT/bin:$PATH";
eval "$(pyenv init -)";
fi
fi

tox -- $TOX_FLAGS
50 changes: 50 additions & 0 deletions .travis/twistedchecker-trunk-diff.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/usr/bin/env sh
#
# Helper for running twistedchecker and reporting only errors that are part
# of the changes since trunk.
#
# Call it as:
# * SCRIPT_NAME twisted
# * SCRIPT_NAME twisted/words/
# * SCRIPT_NAME twisted.words

set -e # Exit with error is a command exits with an unchecked error.
set -u # Exit with error if an undefined variable is dereferenced.

target="$1";

# FIXME: https://github.com/twisted/twistedchecker/issues/116
# Since for unknown modules twistedchecker will return the same error, the
# diff will fail to detect that we are trying to check an invalid path or
# module.
# This is why we check that the argument is a path and if not a path, it is
# an importable module.
if [ ! -d "${target}" ]; then
if ! python -c "import ${target}" 2> /dev/null; then
>&2 echo "${target} does not exists as a path or as a module.";
exit 1;
fi;
fi;

# Make sure we have trunk on the local repo.
git fetch origin "+refs/heads/trunk:refs/remotes/origin/trunk";

# Explicitly ignore extension modules.
# See: https://github.com/twisted/twistedchecker/issues/118
mkdir -p build/;
twistedchecker \
--ignore="raiser.so,portmap.so,_sendmsg.so" \
--disable="${TWISTEDCHECKER_SKIP_WARNINGS:-}" \
--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}' \
"${target}" \
> "build/twistedchecker-branch.report" || true;

# Make sure repo is producing the diff with prefix so that the output of
# `git diff` can be parsed by diff_cover.
git config diff.noprefix false;

diff-quality \
--violations=pylint \
--fail-under=100 \
--compare-branch=origin/trunk \
build/twistedchecker-branch.report;
9 changes: 6 additions & 3 deletions CONTRIBUTING
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ https://twistedmatrix.com/trac/wiki/ContributingToTwistedLabs

Twisted has a Code of Conduct, available at code_of_conduct.md.

**Warning: pull requests are ignored** unless they have an associated ticket in trac.

File a ticket at:

https://twistedmatrix.com/trac/newticket

Twisted uses Trac to keep track of bugs, feature requests, and associated
patches because GitHub doesn't provide adequate tooling for its community.

For a PR to be accepted it needs to have at least all Travis CI tests passing.
Contributions are managed using GitHub's Pull Requests.
For a PR to be accepted it needs to have:

* all Travis CI tests passing
* patch coverage of 100% as reported by codecov.io

The Travis CI tests currently represent only a subset of the all the platforms Twisted supports, so the buildbot tests are still the actual gate for PR acceptance.
4 changes: 3 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2001-2016
Copyright (c) 2001-2017
Allen Short
Amber Hawkie Brown
Andrew Bennetts
Expand Down Expand Up @@ -49,6 +49,8 @@ Timothy Allen
Tom Prince
Travis B. Hartwell

and others that have contributed code to the public domain.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
Expand Down
39 changes: 23 additions & 16 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,44 @@
# - All of the test files, so that the tests can be run on an installed copy.
# We do not want to include:
# - Release management files (e.g. topfiles)
# - Things only useful when running from a source checkout (_preamble.py)
# - Things only useful when running from a source checkout

# Do not include the old topfiles, or news fragments
recursive-exclude twisted *.misc *.bugfix *.doc *.feature *.removal
recursive-exclude twisted NEWS README topfiles
exclude twisted/topfiles/CREDITS twisted/topfiles/ChangeLog.Old
recursive-exclude src/twisted *.misc *.bugfix *.doc *.feature *.removal
recursive-exclude src/twisted NEWS README newsfragments
exclude src/twisted/topfiles/CREDITS src/twisted/topfiles/ChangeLog.Old

# Include NEWS, READMEs, etc
recursive-include docs README
include NEWS README.rst INSTALL.rst CONTRIBUTING LICENSE code_of_conduct.md
include NEWS.rst README.rst INSTALL.rst CONTRIBUTING LICENSE code_of_conduct.md

# Exclude admin scripts and things only useful when running from a source checkout
exclude bin/_preamble.py
exclude admin
exclude bin/admin
recursive-exclude admin *
recursive-exclude bin/admin *
exclude pyproject.toml
exclude codecov.yml
exclude appveyor.yml
prune bin
prune admin
prune .travis
prune .github

# Include test-running utilities for downstream packagers
include tox.ini .coveragerc

# Python 3 setup file
include setup3.py
# Include our docs templates
recursive-include src/twisted/python/_pydoctortemplates *.html

# Include all modules, even on a Python we're not installing for
recursive-include src/twisted *.py

# Some tests stuff
recursive-include twisted *.pem
include twisted/internet/test/fake_CAs/*
include twisted/mail/test/rfc822.message
recursive-include src/twisted *.pem
recursive-include src/twisted/test *.pem.*
include src/twisted/internet/test/fake_CAs/*
include src/twisted/mail/test/rfc822.message

# Some extras
recursive-include twisted *.glade *.pxi *.h *.c *.bat *.g *.pyx *.zsh *.txt
recursive-include src/twisted *.3only
recursive-include src/twisted *.glade *.pxi *.h *.c *.bat *.g *.pyx *.zsh *.txt

# Docs
include docs/fun/lightbulb
Expand Down
Loading