Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkowl committed Aug 1, 2016
2 parents 9095da7 + cfdd18b commit 5ffe7c0
Show file tree
Hide file tree
Showing 328 changed files with 7,113 additions and 3,343 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.o
*.py[co]
*.so
*.DS_Store
_trial_temp*/
build/
dropin.cache
Expand Down
63 changes: 50 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,53 @@
#
# 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

env:
global:
- TRIAL_REPORTER=text

matrix:
include:
- python: 2.7
env: TOXENV=py27-coverage-posix,codecov-publish
# FIXME: https://twistedmatrix.com/trac/ticket/8633
# Coverage should also be reported for nomodules tests so that we also
# get report for those conditional branches.
- python: 2.7
env: TOXENV=py27-nomodules-posix
- python: 3.3
env: TOXENV=py33-coverage-posix,codecov-publish
- python: 3.4
env: TOXENV=py34-coverage-posix,codecov-publish
- python: 3.5
env: TOXENV=py35-coverage-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,topfile,manifest-checker
- python: 3.5
env: TOXENV=pyflakes3
#
# OSX 10.10
#
- language: generic
os: osx
# 7.1 is OS X 10.10.x
# see: https://docs.travis-ci.com/user/languages/objective-c/#Supported-OS-X-iOS-SDK-versions
osx_image: xcode7.1
python: 2.7
env: TOXENV=py27-coverage-posix,codecov-publish

allow_failures:
# For now, OSX run on Travis-CI has a few failures.
- os: osx


addons:
apt:
packages:
Expand All @@ -11,19 +58,8 @@ cache:
directories:
- $HOME/.cache/pip

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
# By default, Travis only clones one branch.
Expand All @@ -33,5 +69,6 @@ before_script:
- git remote set-branches --add origin trunk
- git fetch origin trunk

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

if [[ "$(uname -s)" == 'Darwin' ]]; then
curl -O https://bootstrap.pypa.io/get-pip.py
python get-pip.py --user
python -m pip install --user virtualenv
python -m virtualenv ~/.venv
source ~/.venv/bin/activate
fi

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

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

tox -- $TOX_FLAGS
4 changes: 4 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,14 @@ exclude codecov.yml
exclude appveyor.yml
prune bin
prune admin
prune .travis

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

# Include our docs templates
recursive-include twisted/python/_pydoctortemplates *.html

# Python 3 setup file
include setup3.py

Expand Down
8 changes: 5 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,7 @@ No significant changes have been made for this release.
Twisted Core 15.5.0 (2015-11-28)
================================

This is the last Twisted release where Python 2.6 is supported, on any
platform. Python 3.5 (on POSIX) support has been added.
Python 3.5 (on POSIX) support has been added.

This release introduces changes that are required for Conch's SSH
implementation to work with OpenSSH 6.9+ servers.
Expand Down Expand Up @@ -740,6 +739,9 @@ Other
Twisted Core 15.4.0 (2015-09-04)
================================

This is the last Twisted release where Python 2.6 is supported, on any
platform.

Features
--------
- Trial has been ported to Python 3. (#5965)
Expand Down Expand Up @@ -4487,7 +4489,7 @@ Bugfixes
intermittent error, crashing at startup with a ZeroDivisionError
while trying to report progress. (#4463)
- twisted.conch.ssh.connection.SSHConnection now replies to requests
to open an unknown channel with a OPEN_UNKNOWN_CHANNEL_TYPE message
to open an unknown channel with an OPEN_UNKNOWN_CHANNEL_TYPE message
instead of closing the connection. (#4490)

Deprecations and Removals
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ It includes modules for many different purposes, including the following:
- ``twisted.conch``: SSHv2 and Telnet clients and servers and terminal emulators
- ``twisted.words``: Clients and servers for IRC, XMPP, and other IM protocols
- ``twisted.mail``: IMAPv4, POP3, SMTP clients and servers
- ``twisted.positioning``: Tools for communicating with NMEA-compatible GPS recievers
- ``twisted.positioning``: Tools for communicating with NMEA-compatible GPS receivers
- ``twisted.names``: DNS client and tools for making your own DNS servers
- ``twisted.trial``: A unit testing framework that integrates well with Twisted-based code.

Expand Down
13 changes: 6 additions & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ build: off
# AppVeyor.
test: off

# Don't build branch if there is a open PR, to prevent double builds.
# For now, Appveyour will only build PR commits and not commits to master or
# Don't build branch if there is an open PR, to prevent double builds.
# For now, Appveyor will only build PR commits and not commits to master or
# commits on random branches without an associated PR.
skip_branch_with_pr: true

Expand All @@ -34,11 +34,6 @@ environment:
- PYTHON: C:\Python27-x64
TOXENV: py27-coverage-windows,codecov-publish

# Some tests are failing on Appveyor and they will be fixed in a separate
# ticket.
matrix:
allow_failures:
- PYTHON: C:\Python27-x64

install:
# Get some information about the build environment.
Expand All @@ -54,5 +49,9 @@ install:
# The build system itself is handled by tox.
- "%PYTHON%\\Scripts\\pip install tox"

# Install OpenSSH through chocolatey
- "choco install win32-openssh -confirm"
- cmd: "SET PATH=%PATH%;C:\\Program Files\\OpenSSH-Win64"

test_script:
- "%PYTHON%\\python -m tox -e %TOXENV%"
2 changes: 1 addition & 1 deletion docs/conch/howto/conch_client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ The ``agentEndpoint`` argument gives the ``SSHCommandClientEndpoint`` an opportu
The agent may already be loaded with keys, or may have some other way to authenticate a connection.
Using the agent can mean the process actually establishing the SSH connection doesn't need to load any authentication material (passwords or keys) itself (often convenient in case keys are encrypted and potentially more secure, since only the agent process ever actually holds the secrets).
The value for this argument is another ``IStreamClientEndpoint`` .
Often in a typical *NIX desktop environment, the *SSH_AUTH_SOCK* environment variable will give the location of a AF_UNIX socket.
Often in a typical *NIX desktop environment, the *SSH_AUTH_SOCK* environment variable will give the location of an AF_UNIX socket.
This explains the value ``echoclient_ssh.py`` assigns this parameter when *--no-agent* is not given.


Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
# The scheme of the identifier. Typical schemes are ISBN or URL.
#epub_scheme = ''

# The unique identifier of the text. This can be a ISBN number
# The unique identifier of the text. This can be an ISBN number
# or the project homepage.
#epub_identifier = ''

Expand Down
2 changes: 1 addition & 1 deletion docs/core/development/policy/compatibility-policy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ How to deprecate APIs
Classes
^^^^^^^

Classes are deprecated by raising an warning when they are access from within their module, using the :api:`twisted.python.deprecate.deprecatedModuleAttribute <deprecatedModuleAttribute>` helper.
Classes are deprecated by raising a warning when they are access from within their module, using the :api:`twisted.python.deprecate.deprecatedModuleAttribute <deprecatedModuleAttribute>` helper.

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion docs/core/development/policy/writing-standard.rst
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ that they will see the document do. For example:
backend;
- creating an anonymous access read-only SFTP server using a proxy
backend connecting to an HTTP server; and
- creating a anonymous access read and write SFTP server using a
- creating an anonymous access read and write SFTP server using a
filesystem backend.


Expand Down
30 changes: 20 additions & 10 deletions docs/core/examples/courier.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# See LICENSE for details.

"""
Example of a interfacing to Courier's mail filter interface.
Example of an interface to Courier's mail filter.
"""

LOGFILE = '/tmp/filter.log'
Expand All @@ -24,9 +24,10 @@
ALLFILTERS='/var/lib/courier/allfilters'
FILTERNAME='twistedfilter'

import os, os.path
import email.parser
import email.message
import os, os.path
from syslog import syslog, openlog, LOG_MAIL
from rfc822 import Message

def trace_dump():
t,v,tb = sys.exc_info()
Expand All @@ -38,6 +39,7 @@ def trace_dump():
# just to be safe
del tb


def safe_del(file):
try:
if os.path.isdir(file):
Expand All @@ -48,23 +50,28 @@ def safe_del(file):
pass



class DieWhenLost(Protocol):
def connectionLost(self, reason=None):
reactor.stop()



class MailProcessor(basic.LineReceiver):
"""I process a mail message.
Override filterMessage to do any filtering you want."""
"""
I process a mail message.
Override filterMessage to do any filtering you want.
"""
messageFilename = None
delimiter = '\n'

def connectionMade(self):
log.msg('Connection from %r' % self.transport)
self.state = 'connected'
self.metaInfo = []


def lineReceived(self, line):
if self.state == 'connected':
self.messageFilename = line
Expand All @@ -78,18 +85,21 @@ def lineReceived(self, line):
return
self.filterMessage()


def filterMessage(self):
"""Override this.
A trivial example is included.
"""
try:
m = Message(open(self.messageFilename))
emailParser = email.parser.Parser()
with open(self.messageFilename) as f:
emailParser.parse(f)
self.sendLine('200 Ok')
except:
trace_dump()
self.sendLine('435 %s processing error' % FILTERNAME)


def main():
# Listen on the UNIX socket
Expand All @@ -102,7 +112,7 @@ def main():
reactor.callLater(0, os.close, 3)

# When stdin is closed, it's time to exit.
s = stdio.StandardIO(DieWhenLost())
stdio.StandardIO(DieWhenLost())

# Go!
reactor.run()
Expand Down
2 changes: 1 addition & 1 deletion docs/core/howto/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ Daemon



A instance of :api:`twisted.internet.defer.Deferred <twisted.internet.defer.Deferred>` , an
An instance of :api:`twisted.internet.defer.Deferred <twisted.internet.defer.Deferred>` , an
abstraction for handling chains of callbacks and error handlers
("errbacks" ).
See the :doc:`Deferring Execution <defer>` HOWTO.
Expand Down
7 changes: 7 additions & 0 deletions docs/core/howto/tutorial/client.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,13 @@ using the factory directly, it's also more convenient.



Additionally, because this code now programmatically receives its host and
port, it's a bit less convenient to use clientFromString. Instead, we move to
using the specific endpoint we want. In this case, because we're connecting as
a client over IPv4 using TCP, we want the ``TCP4ClientEndpoint``.






Expand Down
17 changes: 15 additions & 2 deletions docs/core/howto/tutorial/factory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,21 @@ Support HTTPS

All we need to do to code an HTTPS site is just write a context factory (in
this case, which loads the certificate from a certain file) and then use the
twisted.application.internet.SSLServer method. Note that one factory (in this
case, a site) can listen on multiple ports with multiple protocols.
``twisted.internet.endpoints.serverFromString`` method to build a SSL endpoint.
Note that one factory (in this case, a site) can listen on multiple ports with
multiple protocols.

Of course, this endpoint doesn't work without a TLS certificate and a private
key. You'll need to create a self-signed cert and key. This will obviously not
be trusted by your web browser, so you'll see a warning when you connect. In
this case, don't worry: you're not at risk.

To create a certificate and key that can be used by this tutorial, run the
following:

.. code-block:: bash
openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
Expand Down
Loading

0 comments on commit 5ffe7c0

Please sign in to comment.