[Python-modules-commits] [python-aiosmtpd] 01/02: Import Upstream version 1.0

Pierre-Elliott Bécue peb-guest at moszumanska.debian.org
Fri Jun 30 14:49:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

peb-guest pushed a commit to branch master
in repository python-aiosmtpd.

commit 044f9fa5d42e495d9cd95fc9b8a0b9bcf4ac9e16
Author: Pierre-Elliott Bécue <becue at crans.org>
Date:   Mon Jun 26 15:51:04 2017 +0200

    Import Upstream version 1.0
---
 .appveyor.yml                          |   30 +
 .coverage.ini                          |   19 +
 .travis.yml                            |   16 +
 MANIFEST.in                            |    4 +
 PKG-INFO                               |   20 +
 README.rst                             |  119 ++++
 _static/.ignore                        |    0
 aiosmtpd.egg-info/PKG-INFO             |   20 +
 aiosmtpd.egg-info/SOURCES.txt          |   52 ++
 aiosmtpd.egg-info/dependency_links.txt |    1 +
 aiosmtpd.egg-info/entry_points.txt     |    3 +
 aiosmtpd.egg-info/requires.txt         |    1 +
 aiosmtpd.egg-info/top_level.txt        |    2 +
 aiosmtpd/__init__.py                   |    0
 aiosmtpd/__main__.py                   |    5 +
 aiosmtpd/controller.py                 |   75 +++
 aiosmtpd/docs/.gitignore               |    1 +
 aiosmtpd/docs/Makefile                 |  177 ++++++
 aiosmtpd/docs/NEWS.rst                 |   97 +++
 aiosmtpd/docs/__init__.py              |    0
 aiosmtpd/docs/cli.rst                  |   82 +++
 aiosmtpd/docs/concepts.rst             |  127 ++++
 aiosmtpd/docs/controller.rst           |  236 +++++++
 aiosmtpd/docs/handlers.rst             |  230 +++++++
 aiosmtpd/docs/intro.rst                |   44 ++
 aiosmtpd/docs/lmtp.rst                 |   16 +
 aiosmtpd/docs/migrating.rst            |   61 ++
 aiosmtpd/docs/smtp.rst                 |  195 ++++++
 aiosmtpd/handlers.py                   |  218 +++++++
 aiosmtpd/lmtp.py                       |   22 +
 aiosmtpd/main.py                       |  151 +++++
 aiosmtpd/smtp.py                       |  692 +++++++++++++++++++++
 aiosmtpd/testing/__init__.py           |    0
 aiosmtpd/testing/helpers.py            |   60 ++
 aiosmtpd/tests/__init__.py             |    0
 aiosmtpd/tests/certs/__init__.py       |    0
 aiosmtpd/tests/certs/server.crt        |   24 +
 aiosmtpd/tests/certs/server.key        |   28 +
 aiosmtpd/tests/test_handlers.py        |  753 +++++++++++++++++++++++
 aiosmtpd/tests/test_lmtp.py            |   42 ++
 aiosmtpd/tests/test_main.py            |  311 ++++++++++
 aiosmtpd/tests/test_server.py          |   49 ++
 aiosmtpd/tests/test_smtp.py            | 1059 ++++++++++++++++++++++++++++++++
 aiosmtpd/tests/test_starttls.py        |  216 +++++++
 conf.py                                |  282 +++++++++
 examples/__init__.py                   |    0
 examples/client.py                     |   12 +
 examples/server.py                     |   20 +
 setup.cfg                              |   13 +
 setup.py                               |   38 ++
 setup_helpers.py                       |  150 +++++
 tox.ini                                |   62 ++
 unittest.cfg                           |   13 +
 53 files changed, 5848 insertions(+)

diff --git a/.appveyor.yml b/.appveyor.yml
new file mode 100644
index 0000000..65f6768
--- /dev/null
+++ b/.appveyor.yml
@@ -0,0 +1,30 @@
+environment:
+  PYTHONASYNCIODEBUG: "1"
+  PLATFORM: "mswin"
+
+  matrix:
+
+    # For Python versions available on Appveyor, see
+    # http://www.appveyor.com/docs/installed-software#python
+
+    - PYTHON: "C:\\Python34"
+      INTERP: "py34"
+    - PYTHON: "C:\\Python35"
+      INTERP: "py35"
+    - PYTHON: "C:\\Python34-x64"
+      INTERP: "py34"
+      DISTUTILS_USE_SDK: "1"
+    - PYTHON: "C:\\Python35-x64"
+      INTERP: "py35"
+    - PYTHON: "C:\\Python36-x64"
+      INTERP: "py36"
+
+install:
+  - "%PYTHON%\\python.exe -m pip install tox"
+  - "%PYTHON%\\python.exe setup.py egg_info"
+  - "%PYTHON%\\python.exe -m pip install -r aiosmtpd.egg-info/requires.txt"
+
+build: off
+
+test_script:
+  - "%PYTHON%\\python.exe -m tox -e %INTERP%-nocov,%INTERP%-cov"
diff --git a/.coverage.ini b/.coverage.ini
new file mode 100644
index 0000000..01f7db9
--- /dev/null
+++ b/.coverage.ini
@@ -0,0 +1,19 @@
+[run]
+branch = true
+parallel = true
+omit =
+     setup*
+     aiosmtpd/testing/*
+     aiosmtpd/tests/*
+    .tox/*/lib/python3.*/site-packages/*
+
+[paths]
+source =
+    aiosmtpd
+    .tox/*/lib/python*/site-packages/aiosmtpd
+
+[report]
+exclude_lines =
+    pragma: nocover
+    pragma: no${INTERP}
+    pragma: no${PLATFORM}
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..a4511c7
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,16 @@
+language: python
+install:
+  - pip install tox
+  - python3 setup.py egg_info
+  - pip install -r aiosmtpd.egg-info/requires.txt
+matrix:
+  include:
+    - python: "3.4"
+      env: INTERP=py34 PYTHONASYNCIODEBUG=1
+    - python: "3.5"
+      env: INTERP=py35 PYTHONASYNCIODEBUG=1
+    - python: "3.6"
+      env: INTERP=py36 PYTHONASYNCIODEBUG=1
+script:
+  - tox -e $INTERP-nocov,$INTERP-cov,qa,docs
+  - 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then tox -e $INTERP-diffcov; fi'
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..1b19070
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,4 @@
+include *.py MANIFEST.in
+global-include *.txt *.rst *.ini *.yml *.cfg *.crt *.key
+exclude .gitignore
+prune build
diff --git a/PKG-INFO b/PKG-INFO
new file mode 100644
index 0000000..f78f704
--- /dev/null
+++ b/PKG-INFO
@@ -0,0 +1,20 @@
+Metadata-Version: 1.1
+Name: aiosmtpd
+Version: 1.0
+Summary: aiosmtpd - asyncio based SMTP server
+Home-page: https://github.com/aio-libs/aiosmtpd
+Author: https://github.com/aio-libs
+Author-email: UNKNOWN
+License: http://www.apache.org/licenses/LICENSE-2.0
+Description: This is a server for SMTP and related protocols, similar in utility to the
+        standard library's smtpd.py module, but rewritten to be based on asyncio for
+        Python 3.
+Keywords: email
+Platform: UNKNOWN
+Classifier: License :: OSI Approved
+Classifier: Intended Audience :: Developers
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Topic :: Communications :: Email :: Mail Transport Agents
+Classifier: Framework :: AsyncIO
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..7789d13
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,119 @@
+=========================================
+ aiosmtpd - An asyncio based SMTP server
+=========================================
+
+The Python standard library includes a basic
+`SMTP <http://www.faqs.org/rfcs/rfc5321.html>`__ server in the
+`smtpd <https://docs.python.org/3/library/smtpd.html>`__ module, based on the
+old asynchronous libraries
+`asyncore <https://docs.python.org/3/library/asyncore.html>`__ and
+`asynchat <https://docs.python.org/3/library/asynchat.html>`__.  These modules
+are quite old and are definitely showing their age.  asyncore and asynchat are
+difficult APIs to work with, understand, extend, and fix.
+
+With the introduction of the
+`asyncio <https://docs.python.org/3/library/asyncio.html>`__ module in Python
+3.4, a much better way of doing asynchronous I/O is now available.  It seems
+obvious that an asyncio-based version of the SMTP and related protocols are
+needed for Python 3.  This project brings together several highly experienced
+Python developers collaborating on this reimplementation.
+
+This package provides such an implementation of both the SMTP and LMTP
+protocols.
+
+
+Requirements
+============
+
+You need at least Python 3.4 to use this library.  Python 3.3 might work if
+you install the standalone `asyncio <https://pypi.python.org/pypi/asyncio>`__
+library, but this combination is untested and unsupported.  Python 3.5 or
+newer is required for SSL support.  Both Windows and \*nix are supported.
+
+
+License
+=======
+
+``aiosmtpd`` is released under the Apache License version 2.0.
+
+
+Project details
+===============
+
+As of 2016-07-14, aiosmtpd has been put under the `aio-libs
+<https://github.com/aio-libs>`__ umbrella project and moved to GitHub.
+
+* Project home: https://github.com/aio-libs/aiosmtpd
+* Report bugs at: https://github.com/aio-libs/aiosmtpd/issues
+* Git clone: https://github.com/aio-libs/aiosmtpd.git
+* Documentation: http://aiosmtpd.readthedocs.io/
+* StackOverflow: https://stackoverflow.com/questions/tagged/aiosmtpd
+
+The best way to contact the developers is through the GitHub links above.
+You can also request help by submitting a question on StackOverflow.
+
+
+Building
+========
+
+You can install this package in a virtual environment like so::
+
+    $ python3 -m venv /path/to/venv
+    $ source /path/to/venv/bin/activate
+    $ python setup.py install
+
+This will give you a command line script called ``smtpd`` which implements the
+SMTP server.  Use ``smtpd --help`` for details.
+
+You will also have access to the ``aiosmtpd`` library, which you can use as a
+testing environment for your SMTP clients.  See the documentation links above
+for details.
+
+
+Developing
+==========
+
+You'll need the `tox <https://pypi.python.org/pypi/tox>`__ tool to run the
+test suite for Python 3.4, 3.5, and 3.6.  Once you've got that, run::
+
+    $ tox
+
+Individual tests can be run like this::
+
+    $ tox -e py35-nocov -- -P <pattern>
+
+where *<pattern>* is a Python regular expression matching a test name.
+
+You can also add the ``-E`` option to boost debugging output, e.g.::
+
+    $ tox -e py35-nocov -- -E
+
+and these options can be combined::
+
+    $ tox -e py35-nocov -- -P test_connection_reset_during_DATA -E
+
+
+Contents
+========
+
+.. toctree::
+   :maxdepth: 2
+
+   aiosmtpd/docs/intro
+   aiosmtpd/docs/concepts
+   aiosmtpd/docs/cli
+   aiosmtpd/docs/controller
+   aiosmtpd/docs/smtp
+   aiosmtpd/docs/lmtp
+   aiosmtpd/docs/handlers
+   aiosmtpd/docs/migrating
+   aiosmtpd/docs/NEWS
+
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/_static/.ignore b/_static/.ignore
new file mode 100644
index 0000000..e69de29
diff --git a/aiosmtpd.egg-info/PKG-INFO b/aiosmtpd.egg-info/PKG-INFO
new file mode 100644
index 0000000..f78f704
--- /dev/null
+++ b/aiosmtpd.egg-info/PKG-INFO
@@ -0,0 +1,20 @@
+Metadata-Version: 1.1
+Name: aiosmtpd
+Version: 1.0
+Summary: aiosmtpd - asyncio based SMTP server
+Home-page: https://github.com/aio-libs/aiosmtpd
+Author: https://github.com/aio-libs
+Author-email: UNKNOWN
+License: http://www.apache.org/licenses/LICENSE-2.0
+Description: This is a server for SMTP and related protocols, similar in utility to the
+        standard library's smtpd.py module, but rewritten to be based on asyncio for
+        Python 3.
+Keywords: email
+Platform: UNKNOWN
+Classifier: License :: OSI Approved
+Classifier: Intended Audience :: Developers
+Classifier: Programming Language :: Python :: 3.4
+Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
+Classifier: Topic :: Communications :: Email :: Mail Transport Agents
+Classifier: Framework :: AsyncIO
diff --git a/aiosmtpd.egg-info/SOURCES.txt b/aiosmtpd.egg-info/SOURCES.txt
new file mode 100644
index 0000000..5573d7f
--- /dev/null
+++ b/aiosmtpd.egg-info/SOURCES.txt
@@ -0,0 +1,52 @@
+.appveyor.yml
+.coverage.ini
+.travis.yml
+MANIFEST.in
+README.rst
+conf.py
+setup.cfg
+setup.py
+setup_helpers.py
+tox.ini
+unittest.cfg
+_static/.ignore
+aiosmtpd/__init__.py
+aiosmtpd/__main__.py
+aiosmtpd/controller.py
+aiosmtpd/handlers.py
+aiosmtpd/lmtp.py
+aiosmtpd/main.py
+aiosmtpd/smtp.py
+aiosmtpd.egg-info/PKG-INFO
+aiosmtpd.egg-info/SOURCES.txt
+aiosmtpd.egg-info/dependency_links.txt
+aiosmtpd.egg-info/entry_points.txt
+aiosmtpd.egg-info/requires.txt
+aiosmtpd.egg-info/top_level.txt
+aiosmtpd/docs/.gitignore
+aiosmtpd/docs/Makefile
+aiosmtpd/docs/NEWS.rst
+aiosmtpd/docs/__init__.py
+aiosmtpd/docs/cli.rst
+aiosmtpd/docs/concepts.rst
+aiosmtpd/docs/controller.rst
+aiosmtpd/docs/handlers.rst
+aiosmtpd/docs/intro.rst
+aiosmtpd/docs/lmtp.rst
+aiosmtpd/docs/migrating.rst
+aiosmtpd/docs/smtp.rst
+aiosmtpd/testing/__init__.py
+aiosmtpd/testing/helpers.py
+aiosmtpd/tests/__init__.py
+aiosmtpd/tests/test_handlers.py
+aiosmtpd/tests/test_lmtp.py
+aiosmtpd/tests/test_main.py
+aiosmtpd/tests/test_server.py
+aiosmtpd/tests/test_smtp.py
+aiosmtpd/tests/test_starttls.py
+aiosmtpd/tests/certs/__init__.py
+aiosmtpd/tests/certs/server.crt
+aiosmtpd/tests/certs/server.key
+examples/__init__.py
+examples/client.py
+examples/server.py
\ No newline at end of file
diff --git a/aiosmtpd.egg-info/dependency_links.txt b/aiosmtpd.egg-info/dependency_links.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/aiosmtpd.egg-info/dependency_links.txt
@@ -0,0 +1 @@
+
diff --git a/aiosmtpd.egg-info/entry_points.txt b/aiosmtpd.egg-info/entry_points.txt
new file mode 100644
index 0000000..ef42d13
--- /dev/null
+++ b/aiosmtpd.egg-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+aiosmtpd = aiosmtpd.main:main
+
diff --git a/aiosmtpd.egg-info/requires.txt b/aiosmtpd.egg-info/requires.txt
new file mode 100644
index 0000000..4cd98b3
--- /dev/null
+++ b/aiosmtpd.egg-info/requires.txt
@@ -0,0 +1 @@
+atpublic
diff --git a/aiosmtpd.egg-info/top_level.txt b/aiosmtpd.egg-info/top_level.txt
new file mode 100644
index 0000000..4a62097
--- /dev/null
+++ b/aiosmtpd.egg-info/top_level.txt
@@ -0,0 +1,2 @@
+aiosmtpd
+examples
diff --git a/aiosmtpd/__init__.py b/aiosmtpd/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/aiosmtpd/__main__.py b/aiosmtpd/__main__.py
new file mode 100644
index 0000000..2e77d22
--- /dev/null
+++ b/aiosmtpd/__main__.py
@@ -0,0 +1,5 @@
+from aiosmtpd.main import main
+
+
+if __name__ == '__main__':
+    main()
diff --git a/aiosmtpd/controller.py b/aiosmtpd/controller.py
new file mode 100644
index 0000000..8771cb1
--- /dev/null
+++ b/aiosmtpd/controller.py
@@ -0,0 +1,75 @@
+import os
+import socket
+import asyncio
+import threading
+
+from aiosmtpd.smtp import SMTP
+from public import public
+
+try:
+    from socket import socketpair
+except ImportError:                                          # pragma: nocover
+    from asyncio.windows_utils import socketpair
+
+
+ at public
+class Controller:
+    def __init__(self, handler, loop=None, hostname=None, port=8025, *,
+                 ready_timeout=1.0, enable_SMTPUTF8=True):
+        self.handler = handler
+        self.hostname = '::1' if hostname is None else hostname
+        self.port = port
+        self.enable_SMTPUTF8 = enable_SMTPUTF8
+        self.loop = asyncio.new_event_loop() if loop is None else loop
+        self.server = None
+        self._thread = None
+        self._thread_exception = None
+        self.ready_timeout = os.getenv(
+            'AIOSMTPD_CONTROLLER_TIMEOUT', ready_timeout)
+        # For exiting the loop.
+        self._rsock, self._wsock = socketpair()
+        self.loop.add_reader(self._rsock, self._reader)
+
+    def _reader(self):
+        self.loop.remove_reader(self._rsock)
+        self.loop.stop()
+        for task in asyncio.Task.all_tasks(self.loop):
+            task.cancel()
+        self._rsock.close()
+        self._wsock.close()
+
+    def factory(self):
+        """Allow subclasses to customize the handler/server creation."""
+        return SMTP(self.handler, enable_SMTPUTF8=self.enable_SMTPUTF8)
+
+    def _run(self, ready_event):
+        asyncio.set_event_loop(self.loop)
+        try:
+            self.server = self.loop.run_until_complete(
+                self.loop.create_server(
+                    self.factory, host=self.hostname, port=self.port))
+        except socket.error as error:
+            self._thread_exception = error
+            return
+        self.loop.call_soon(ready_event.set)
+        self.loop.run_forever()
+        self.server.close()
+        self.loop.run_until_complete(self.server.wait_closed())
+        self.loop.close()
+        self.server = None
+
+    def start(self):
+        assert self._thread is None, 'SMTP daemon already running'
+        ready_event = threading.Event()
+        self._thread = threading.Thread(target=self._run, args=(ready_event,))
+        self._thread.daemon = True
+        self._thread.start()
+        # Wait a while until the server is responding.
+        ready_event.wait(self.ready_timeout)
+        if self._thread_exception is not None:
+            raise self._thread_exception
+
+    def stop(self):
+        assert self._thread is not None, 'SMTP daemon not running'
+        self._wsock.send(b'x')
+        self._thread.join()
diff --git a/aiosmtpd/docs/.gitignore b/aiosmtpd/docs/.gitignore
new file mode 100644
index 0000000..e35d885
--- /dev/null
+++ b/aiosmtpd/docs/.gitignore
@@ -0,0 +1 @@
+_build
diff --git a/aiosmtpd/docs/Makefile b/aiosmtpd/docs/Makefile
new file mode 100644
index 0000000..be5d54d
--- /dev/null
+++ b/aiosmtpd/docs/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS    =
+SPHINXBUILD   = sphinx-build
+PAPER         =
+BUILDDIR      = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4     = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS  = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+	@echo "Please use \`make <target>' where <target> is one of"
+	@echo "  html       to make standalone HTML files"
+	@echo "  dirhtml    to make HTML files named index.html in directories"
+	@echo "  singlehtml to make a single large HTML file"
+	@echo "  pickle     to make pickle files"
+	@echo "  json       to make JSON files"
+	@echo "  htmlhelp   to make HTML files and a HTML help project"
+	@echo "  qthelp     to make HTML files and a qthelp project"
+	@echo "  devhelp    to make HTML files and a Devhelp project"
+	@echo "  epub       to make an epub"
+	@echo "  latex      to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  latexpdf   to make LaTeX files and run them through pdflatex"
+	@echo "  latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+	@echo "  text       to make text files"
+	@echo "  man        to make manual pages"
+	@echo "  texinfo    to make Texinfo files"
+	@echo "  info       to make Texinfo files and run them through makeinfo"
+	@echo "  gettext    to make PO message catalogs"
+	@echo "  changes    to make an overview of all changed/added/deprecated items"
+	@echo "  xml        to make Docutils-native XML files"
+	@echo "  pseudoxml  to make pseudoxml-XML files for display purposes"
+	@echo "  linkcheck  to check all external links for integrity"
+	@echo "  doctest    to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+	rm -rf $(BUILDDIR)/*
+
+html:
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+	@echo
+	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+	@echo
+	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+	@echo
+	@echo "Build finished; now you can process the pickle files."
+
+json:
+	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+	@echo
+	@echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \
+	      ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+	@echo
+	@echo "Build finished; now you can run "qcollectiongenerator" with the" \
+	      ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/aiosmtpd.qhcp"
+	@echo "To view the help file:"
+	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/aiosmtpd.qhc"
+
+devhelp:
+	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+	@echo
+	@echo "Build finished."
+	@echo "To view the help file:"
+	@echo "# mkdir -p $$HOME/.local/share/devhelp/aiosmtpd"
+	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/aiosmtpd"
+	@echo "# devhelp"
+
+epub:
+	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+	@echo
+	@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+	@echo "Run \`make' in that directory to run these through (pdf)latex" \
+	      "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through pdflatex..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+	@echo "Running LaTeX files through platex and dvipdfmx..."
+	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+	@echo
+	@echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+	@echo
+	@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo
+	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+	@echo "Run \`make' in that directory to run these through makeinfo" \
+	      "(use \`make info' here to do that automatically)."
+
+info:
+	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+	@echo "Running Texinfo files through makeinfo..."
+	make -C $(BUILDDIR)/texinfo info
+	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+	@echo
+	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+	@echo
+	@echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \
+	      "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+	@echo "Testing of doctests in the sources finished, look at the " \
+	      "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+	@echo
+	@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+	@echo
+	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/aiosmtpd/docs/NEWS.rst b/aiosmtpd/docs/NEWS.rst
new file mode 100644
index 0000000..66084eb
--- /dev/null
+++ b/aiosmtpd/docs/NEWS.rst
@@ -0,0 +1,97 @@
+===================
+ NEWS for aiosmtpd
+===================
+
+1.0 (2017-05-15)
+================
+* Release.
+
+1.0rc1 (2017-05-12)
+===================
+* Improved documentation.
+
+1.0b1 (2017-05-07)
+==================
+* The connection peer is displayed in all INFO level logging.
+* When running the test suite, you can include a ``-E`` option after the
+  ``--`` separator to boost the debugging output.
+* The main SMTP readline loops are now more robust against connection resets
+  and mid-read EOFs.  (Closes #62)
+* ``Proxy`` handlers work with ``SMTP`` servers regardless of the value of the
+  ``decode_data`` argument.
+* The command line script is now installed as ``aiosmtpd`` instead of
+  ``smtpd``.
+* The ``SMTP`` class now does a better job of handling Unicode, when the
+  client does not claim to support ``SMTPUTF8`` but sends non-ASCII anyway.
+  The server forces ASCII-only handling when ``enable_SMTPUTF8=False`` (the
+  default) is passed to the constructor.  The command line arguments
+  ``decode_data=True`` and ``enable_SMTPUTF8=True`` are no longer mutually
+  exclusive.
+* Officially support Windows.  (Closes #76)
+
+1.0a5 (2017-04-06)
+==================
+* A new handler hook API has been added which provides more flexibility but
+  requires more responsibility (e.g. hooks must return a string status).
+  Deprecate ``SMTP.ehlo_hook()`` and ``SMTP.rset_hook()``.
+* Deprecate handler ``process_message()`` methods.  Use the new asynchronous
+  ``handle_DATA()`` methods, which take a session and an envelope object.
+* Added the ``STARTTLS`` extension.  Given by Konstantin Volkov.
+* Minor changes to the way the ``Debugging`` handler prints ``mail_options``
+  and ``rcpt_options`` (although the latter is still not support in ``SMTP``).
+* ``DATA`` method now respects original line endings, and passing size limits
+  is now handled better.  Given by Konstantin Volkov.
+* The ``Controller`` class has two new optional keyword arguments.
+
+  - ``ready_timeout`` specifies a timeout in seconds that can be used to limit
+    the amount of time it waits for the server to become ready.  This can also
+    be overridden with the environment variable
+    ``AIOSMTPD_CONTROLLER_TIMEOUT``. (Closes #35)
+  - ``enable_SMTPUTF8`` is passed through to the ``SMTP`` constructor in the
+    default factory.  If you override ``Controller.factory()`` you can pass
+    ``self.enable_SMTPUTF8`` yourself.
+* Handlers can define a ``handle_tls_handshake()`` method, which takes a
+  session object, and is called if SSL is enabled during the making of the
+  connection.  (Closes #48)
+* Better Windows compatibility.
+* Better Python 3.4 compatibility.
+* Use ``flufl.testing`` package for nose2 and flake8 plugins.
+* The test suite has achieved 100% code coverage. (Closes #2)
+
+1.0a4 (2016-11-29)
+==================
+* The SMTP server connection identifier can be changed by setting the
+  ``__ident__`` attribute on the ``SMTP`` instance.  (Closes #20)
+* Fixed a new incompatibility with the ``atpublic`` library.
+
+1.0a3 (2016-11-24)
+==================
+* Fix typo in ``Message.prepare_message()`` handler.  The crafted
+  ``X-RcptTos`` header is renamed to ``X-RcptTo`` for backward compatibility
+  with older libraries.
+* Add a few hooks to make subclassing easier:
+
+  * ``SMTP.ehlo_hook()`` is called just before the final, non-continuing 250
+    response to allow subclasses to add additional ``EHLO`` sub-responses.
+  * ``SMTP.rset_hook()`` is called just before the final 250 command to allow
+    subclasses to provide additional ``RSET`` functionality.
+  * ``Controller.make_socket()`` allows subclasses to customize the creation
+    of the socket before binding.
+
+1.0a2 (2016-11-22)
+==================
+* Officially support Python 3.6.
+* Fix support for both IPv4 and IPv6 based on the ``--listen`` option.  Given
+  by Jason Coombs.  (Closes #3)
+* Correctly handle client disconnects.  Given by Konstantin vz'One Enchant.
+* The SMTP class now takes an optional ``hostname`` argument.  Use this if you
+  want to avoid the use of ``socket.getfqdn()``.  Given by Konstantin vz'One
+  Enchant.
+* Close the transport and thus the connection on SMTP ``QUIT``.  (Closes #11)
+* Added an ``AsyncMessage`` handler.  Given by Konstantin vz'One Enchant.
+* Add an examples/ directory.
+* Flake8 clean.
+
+1.0a1 (2015-10-19)
+==================
+* Initial release.
diff --git a/aiosmtpd/docs/__init__.py b/aiosmtpd/docs/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/aiosmtpd/docs/cli.rst b/aiosmtpd/docs/cli.rst
new file mode 100644
index 0000000..b14dbb3
--- /dev/null
+++ b/aiosmtpd/docs/cli.rst
@@ -0,0 +1,82 @@
+.. _cli:
+
+====================
+ Command line usage
+====================
+
+``aiosmtpd`` provides a main entry point which can be used to run the server
+on the command line.  There are two ways to run the server, depending on how
+the package has been installed.
+
+You can run the server by passing it to Python directly::
+
+    $ python3 -m aiosmtpd -n
+
+This starts a server on localhost, port 8025 without setting the uid to
+'nobody' (i.e. because you aren't running it as root).  Once you've done that,
+you can connect directly to the server using your favorite command line
+protocol tool.  Type the ``QUIT`` command at the server once you see the
+greeting::
+
+    % telnet localhost 8025
+    Trying 127.0.0.1...
+    Connected to localhost.
+    Escape character is '^]'.
+    220 subdivisions Python SMTP ...
+    QUIT
+    221 Bye
+    Connection closed by foreign host.
+
+Of course, you could use Python's smtplib_ module, or any other SMTP client to
+talk to the server.
+
+Hit control-C at the server to stop it.
+
+The entry point may also be installed as the ``aiosmtpd`` command, so this is
+equivalent to the above ``python3`` invocation::
+
+    $ aiosmtpd -n
+
+
+Options
+=======
+
+Optional arguments include:
+
+``-h``, ``--help``
+    Show this help message and exit.
+
+``-n``, ``--nosetuid``
+    This program generally tries to setuid ``nobody``, unless this flag is
+    set.  The setuid call will fail if this program is not run as root (in
+    which case, use this flag).
+
+``-c CLASSPATH``, ``--class CLASSPATH``
+    Use the given class, as a Python dotted import path, as the :ref:`handler
+    class <handlers>` for SMTP events.  This class can process received
+    messages and do other actions during the SMTP dialog.  Uses a debugging
+    handler by default.
+
+``-s SIZE``, ``--size SIZE``
+    Restrict the total size of the incoming message to ``SIZE`` number of
+    bytes via the `RFC 1870`_ ``SIZE`` extension.  Defaults to 33554432 bytes.
+
+``-u``, ``--smtputf8``
+    Enable the SMTPUTF8 extension and behave as an `RFC 6531`_ SMTP proxy.
+
+``-d``, ``--debug``
+    Increase debugging output.
+
+``-l [HOST:PORT]``, ``--listen [HOST:PORT]``
+    Optional host and port to listen on.  If the ``PORT`` part is not given,
+    then port 8025 is used.  If only ``:PORT`` is given, then ``localhost`` is
+    used for the host name.  If neither are given, ``localhost:8025`` is used.
+
+Optional positional arguments provide additional arguments to the handler
+class constructor named in the ``--class`` option.  Provide as many of these
+as supported by the handler class's ``from_cli()`` class method, if provided.
+
+
+.. _smtplib: https://docs.python.org/3/library/smtplib.html
+.. _`RFC 1870`: http://www.faqs.org/rfcs/rfc1870.html
+.. _`RFC 6531`: http://www.faqs.org/rfcs/rfc6531.html
diff --git a/aiosmtpd/docs/concepts.rst b/aiosmtpd/docs/concepts.rst
new file mode 100644
index 0000000..20b8bbd
--- /dev/null
+++ b/aiosmtpd/docs/concepts.rst
@@ -0,0 +1,127 @@
+==========
+ Concepts
+==========
+
+There are two general ways you can run the SMTP server, via the :ref:`command
+line <cli>` or :ref:`programmatically <controller>`.
+
+There are several dimensions in which you can extend the basic functionality
+of the SMTP server.  You can implement an *event handler* which uses well
+defined :ref:`handler hooks <hooks>` that are called during the various steps
+in the SMTP dialog.  If such a hook is implemented, it assumes responsibility
+for the status messages returned to the client.
+
+You can also :ref:`subclass <subclass>` the core ``SMTP`` class to implement
+new commands, or change the semantics of existing commands.
+
+For example, if you wanted to print the received message on the console, you
+could implement a handler that hooks into the ``DATA`` command.  The contents
+of the message will be available on one of the hook's arguments, and your
+handler could print this content to stdout.
+
+On the other hand, if you wanted to implement an SMTP-like server that adds a
+new command called ``PING``, you would do this by subclassing ``SMTP``, adding
+a method that implements whatever semantics for ``PING`` that you want.
+
+
+.. _sessions_and_envelopes:
+
+Sessions and envelopes
+======================
+
+Two classes are used during the SMTP dialog with clients.  Instances of these
+are passed to the handler hooks.
+
+
+Session
+-------
+
+The session represents the state built up during a client's socket connection
+to the server.  Each time a client connects to the server, a new session
+object is created.
+
+.. class:: Session()
+
+   .. attribute:: peer
+
+      Defaulting to None, this attribute will contain the transport's socket's
+      peername_ value.
+
+   .. attribute:: ssl
+
+      Defaulting to None, this attribute will contain some extra information,
+      as a dictionary, from the ``asyncio.sslproto.SSLProtocol`` instance.
+      This dictionary provides additional information about the connection.
+      It contains implementation-specific information so its contents may
+      change, but it should roughly correspond to the information available
+      through `this method`_.
+
+   .. attribute:: host_name
+
+      Defaulting to None, this attribute will contain the host name argument
+      as seen in the ``HELO`` or ``EHLO`` (or for :ref:`LMTP <LMTP>`, the
+      ``LHLO``) command.
+
+   .. attribute:: extended_smtp
+
+      Defaulting to False, this flag will be True when the ``EHLO`` greeting
+      was seen, indicating ESMTP_.
+
+   .. attribute:: loop
+
+      This is the asyncio event loop instance.
+
+
+Envelope
+--------
+
+The envelope represents state built up during the client's SMTP dialog.  Each
+time the protocol state is reset, a new envelope is created.  E.g. when the
+SMTP ``RSET`` command is sent, the state is reset and a new envelope is
+created.  A new envelope is also created after the ``DATA`` command is
+completed, or in certain error conditions as mandated by `RFC 5321`_.
+
+.. class:: Envelope
+
+   .. attribute:: mail_from
+
+      Defaulting to None, this attribute holds the email address given in the
+      ``MAIL FROM`` command.
+
+   .. attribute:: mail_options
... 5207 lines suppressed ...

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-aiosmtpd.git



More information about the Python-modules-commits mailing list