Skip to content

Commit fbd2038

Browse files
author
Menno Smits
committed
Merged stable into default
2 parents 45b8164 + 621f1e9 commit fbd2038

File tree

8 files changed

+119
-19
lines changed

8 files changed

+119
-19
lines changed

NEWS.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ IMAPClient's release history is now part of the main
22
documentation_. See the `release documentation`_ on `Read the Docs`_ for
33
the most up-to-date details of IMAPClient's releases.
44

5-
.. _documentation: http://imapclient.readthedocs.org/en/latest/
6-
.. _release documentation: http://imapclient.readthedocs.org/en/latest/releases.html
5+
.. _documentation: http://imapclient.readthedocs.io/en/latest/
6+
.. _release documentation: http://imapclient.readthedocs.io/en/latest/releases.html
77
.. _Read the Docs: http://readthedocs.org

README.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Features:
1717
- Convenience methods are provided for commonly used functionality.
1818
- Exceptions are raised when errors occur.
1919

20-
Python versions 2.6, 2.7, 3.3 and 3.4 are officially supported.
20+
Python versions 2.6, 2.7, 3.3, 3.4 and 3.5 are officially supported.
2121

2222
The current stable version of IMAPClient is 1.0.1. It is licensed
2323
under the New BSD License.
@@ -63,7 +63,7 @@ available. See http://packages.python.org/distribute/ for more info.
6363

6464
Documentation
6565
-------------
66-
IMAPClient's manual is available at http://imapclient.readthedocs.org/
66+
IMAPClient's manual is available at http://imapclient.readthedocs.io/
6767

6868
The `NEWS <https://bitbucket.org/mjs0/imapclient/src/tip/NEWS.rst>`_
6969
file also has useful information.
@@ -159,12 +159,13 @@ compatibility with a given IMAP server implementation.
159159

160160
The livetest functionality can also be accessed like this::
161161

162-
python -m imapclient.livetest ...
162+
python -m imapclient.livetest <livetest.ini> [ optional unittest arguments ]
163163

164164
Alternatively you can run the ``livetest.py`` script included with the
165-
source distribution.
165+
source distribution. Use ``livetest.py --help`` to see usage.
166166

167-
Use the --help option to see usage.
167+
The configuration file format is
168+
`described in the main documentation <http://imapclient.rtfd.io/#configuration-file-format>`_.
168169

169170
**WARNING**: The operations used by livetest are destructive and could
170171
cause unintended loss of data. That said, as of version 0.9, livetest

doc/src/index.rst

Lines changed: 63 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
:Date: |today|
88
:Homepage: http://imapclient.freshfoo.com
99
:Download: http://pypi.python.org/pypi/IMAPClient/
10-
:Documentation: http://imapclient.readthedocs.org/
10+
:Documentation: http://imapclient.readthedocs.io/
1111
:License: `New BSD License <http://en.wikipedia.org/wiki/BSD_licenses>`_
1212
:Support: `Mailing List <https://groups.io/g/imapclient>`_
1313

@@ -175,6 +175,18 @@ The above examples show some of the most common TLS parameter
175175
customisations but there are many other tweaks are possible. Consult
176176
the Python 3 :py:mod:`ssl` package documentation for further options.
177177

178+
Old pyOpenSSL Versions
179+
+++++++++++++++++++++++
180+
181+
IMAPClient's TLS functionality will not behaviour correctly if an
182+
out-of-date version of pyOpenSSL is used. On some systems
183+
(particularly OS X) the system installed version of pyOpenSSL will
184+
take precedence over any user installed version. Use of virtualenvs is
185+
strongly encouraged to work around this.
186+
187+
IMAPClient checks the installed pyOpenSSL version at import time and
188+
will fail early if an old pyOpenSSL version is found.
189+
178190
Using gevent with IMAPClient
179191
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
180192
Some extra monkey patching is required so that the gevent_ package can
@@ -261,12 +273,18 @@ Various options are available to specify the IMAP server details. See
261273
the help (--help) for more details. You'll be prompted for a username
262274
and password if one isn't provided on the command line.
263275

264-
The connected IMAPClient instance is available as the variable "c".
276+
It is also possible to pass connection details as a configuration file
277+
like this::
278+
279+
python -m imapclient.interact -f <config file>
280+
281+
See below for details of the :ref:`configuration file format<conf-files>`.
265282

266283
If installed, IPython will be used as the embedded shell. Otherwise
267284
the basic built-in Python shell will be used.
268285

269-
Here's an example session::
286+
The connected IMAPClient instance is available as the variable
287+
"c". Here's an example session::
270288

271289
$ python -m imapclient.interact -H <host> -u <user> ...
272290
Connecting...
@@ -297,6 +315,48 @@ Here's an example session::
297315
In [3]: c.logout()
298316
Out[3]: b'Logging out'
299317

318+
.. _conf-files:
319+
320+
Configuration File Format
321+
-------------------------
322+
Both the IMAPClient interactive shell and the live tests take
323+
configuration files which specify how to to connect to an IMAP
324+
server. The configuration file format is the same for both.
325+
326+
Configuration files use the INI format and must always have a section
327+
called ``DEFAULT``. Here's a simple example::
328+
329+
[DEFAULT]
330+
host = imap.mailserver.com
331+
username = bob
332+
password = sekret
333+
ssl = True
334+
335+
The supported options are:
336+
337+
==================== ======= =========================================================================================
338+
Name Type Description
339+
==================== ======= =========================================================================================
340+
host string IMAP hostname to connect to.
341+
username string The username to authenticate as.
342+
password string The password to use with ``username``.
343+
port int Server port to connect to. Defaults to 143 unless ``ssl`` is True.
344+
ssl bool Use SSL/TLS to connect.
345+
starttls bool Use STARTTLS to connect.
346+
ssl_check_hostname bool If true and SSL is in use, check that certificate matches the hostname (defaults to true)
347+
ssl_verify_cert bool If true and SSL is in use, check that the certifcate is valid (defaults to true).
348+
ssl_ca_file string If SSL is true, use this to specify certificate authority certs to validate with.
349+
timeout int Time out I/O operations after this many seconds.
350+
oauth2 bool If true, use OAUTH2 to authenticate (``username`` and ``password`` are ignored).
351+
oauth2_client_id string OAUTH2 client id.
352+
oauth2_client_secret string OAUTH2 client secret.
353+
oauth2_refresh_token string OAUTH2 token for refreshing the secret.
354+
==================== ======= =========================================================================================
355+
356+
Acceptable boolean values are "1", "yes", "true", and "on", for true;
357+
and "0", "no", "false", and "off", for false.
358+
359+
300360
External Documentation
301361
----------------------
302362
The `Unofficial IMAP Protocol Wiki <http://www.imapwiki.org/>`_ is

doc/src/releases.rst

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,24 @@ Added
88
-----
99
- PLAIN authentication support (via `plain_login` method)
1010

11+
===============
12+
Version 1.0.2
13+
===============
14+
15+
New
16+
---
17+
- Documented the livetest/interact INI file format.
18+
19+
Changed
20+
-------
21+
- Explicitly check that the required pyOpenSSL version is installed
22+
- Start testing against Python 3.5
23+
- Update doc links from readthedocs.org to readthedocs.io
24+
25+
Fixed
26+
-----
27+
- Allow installation from alternate directories
28+
1129
===============
1230
Version 1.0.1
1331
===============
@@ -69,7 +87,7 @@ on all of the above.
6987
Many thanks to Chris Arndt and Marc-Antoine Parent for their input
7088
into these TLS improvements.
7189

72-
.. _Exceptions: http://imapclient.readthedocs.org/en/latest/#exceptions
90+
.. _Exceptions: http://imapclient.readthedocs.io/en/latest/#exceptions
7391

7492
STARTTLS support [NEW]
7593
----------------------
@@ -533,7 +551,7 @@ responses in the same format as idle_check() and idle_done().
533551
Sphinx Based Docs (#5) [NEW]
534552
----------------------------
535553
Full documentation is now available under doc/html in the source
536-
distribution and at http://imapclient.readthedocs.org/ online.
554+
distribution and at http://imapclient.readthedocs.io/ online.
537555

538556
Added rename_folder (#77) [NEW]
539557
--------------------------------

imapclient/tls.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,37 @@
1111
"""
1212

1313
import imaplib
14+
import os
1415
import socket
1516
import sys
1617

18+
__all__ = ('create_default_context',)
19+
20+
# Explicitly check that the required pyOpenSSL is installed. On some
21+
# systems (particularly OS X) the system installed version will be
22+
# seen before any user installed version. Using a virtualenv is
23+
# recommended to work around this.
24+
def check_pyopenssl_version():
25+
from distutils.version import LooseVersion as V
26+
from OpenSSL import __version__ as installed_pyopenssl_version
27+
from .version import min_pyopenssl_version
28+
29+
if V(installed_pyopenssl_version) < V(min_pyopenssl_version):
30+
raise ImportError(
31+
"pyOpenSSL version (%s) is too old. Need at least %s.\n"
32+
"See http://imapclient.rtfd.io/#old-pyopenssl-versions"
33+
% (installed_pyopenssl_version, min_pyopenssl_version))
34+
35+
if os.environ.get("READTHEDOCS") != "True":
36+
check_pyopenssl_version()
37+
1738
try:
1839
from backports import ssl
1940
except ImportError:
2041
raise ImportError("backports.ssl is not installed")
2142

22-
__all__ = ('create_default_context',)
23-
2443
_ossl = ssl.ossl
2544

26-
2745
if sys.platform == "win32":
2846
try:
2947
from ssl import enum_certificates, Purpose

imapclient/version.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from __future__ import unicode_literals
66

7-
version_info = (1, 0, 1, 'final')
7+
version_info = (1, 0, 2, 'alpha')
88

99

1010
def _imapclient_version_string(vinfo):
@@ -17,3 +17,5 @@ def _imapclient_version_string(vinfo):
1717
version = _imapclient_version_string(version_info)
1818
author = 'Menno Smits'
1919
author_email = '[email protected]'
20+
21+
min_pyopenssl_version = '0.15.1'

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
IS_PY_34_OR_NEWER = MAJ_MIN >= (3, 4)
2121

2222
# Read version info
23-
version_file = path.join('imapclient', 'version.py')
23+
here = path.dirname(__file__)
24+
version_file = path.join(here, 'imapclient', 'version.py')
2425
info = {}
2526
if IS_PY3:
2627
exec(open(version_file).read(), {}, info)
@@ -65,7 +66,7 @@ def run_tests(self):
6566

6667
main_deps = [
6768
'backports.ssl>=0.0.9',
68-
'pyopenssl>=0.15.1',
69+
'pyopenssl>=' + info["min_pyopenssl_version"],
6970
'six',
7071
'mock==1.3.0'
7172
]

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist=py26,py27,py33,py34
2+
envlist=py26,py27,py33,py34,py35
33

44
# The tests are currently run directly out of the source tree.
55
# See the notes in build-sdist for more details.

0 commit comments

Comments
 (0)