115238e52cac5964287a644826ffb0c770d48520 — Stefan Schwarzer 5 years ago 047fdd2
Emit deprecation warning when used under Python 2

If Python is run with deprecation warnings enabled (say, with the
`-Wd` option), an import of `ftputil` will show a deprecation warning
under Python 2.

ftputil 4.0.0 (to be released this or next year) will drop Python 2
support. See also


ticket: 111
1 files changed, 9 insertions(+), 0 deletions(-)

M ftputil/__init__.py
M ftputil/__init__.py => ftputil/__init__.py +9 -0
@@ 47,10 47,19 @@ Note: ftputil currently is not threadsafe. More specifically, you can
from __future__ import absolute_import
from __future__ import unicode_literals

import sys
import warnings

from ftputil.host    import FTPHost
from ftputil.version import __version__

# `sys.version_info.major` isn't available in Python 2.6.
if sys.version_info[0] == 2:
    warnings.warn("Python 2 suport will be dropped in ftputil 4.0.0",
                  DeprecationWarning, stacklevel=2)

# Apart from `ftputil.error` and `ftputil.stat`, this is the whole
# public API of `ftputil`.
__all__ = ["FTPHost", "__version__"]