Changeset 1687:c48d3e1a3e8a


Ignore:
Timestamp:
Oct 28, 2017, 11:53:04 PM (14 months ago)
Author:
Stefan Schwarzer <sschwarzer@…>
Branch:
default
amend_source:
add78bddc4a80eaea2b6c3f4d44156c164f26f09
Message:
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

  http://lists.sschwarzer.net/pipermail/ftputil/2017q3/000465.html

ticket: 111
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ftputil/__init__.py

    r1564 r1687  
    4848from __future__ import unicode_literals
    4949
     50import sys
     51import warnings
     52
    5053from ftputil.host    import FTPHost
    5154from ftputil.version import __version__
     55
     56
     57# `sys.version_info.major` isn't available in Python 2.6.
     58if sys.version_info[0] == 2:
     59    warnings.warn("Python 2 suport will be dropped in ftputil 4.0.0",
     60                  DeprecationWarning, stacklevel=2)
    5261
    5362
Note: See TracChangeset for help on using the changeset viewer.