Rely on Python 3.4 backport of configparser

Python 2.7's ConfigParser module does not allow for the behaviour we
have documented for config files in Flake8 3.0. To compensate for that,
we add a dependency on the configparser backport on PyPI for Python 2.7
This commit is contained in:
Ian Cordasco 2016-05-30 12:44:58 -05:00
parent e9ddf7533b
commit 33f982b446
6 changed files with 13 additions and 11 deletions

View file

@ -155,6 +155,14 @@ This would allow us to add comments for why we're excluding items, e.g.,
dist dist
max-complexity = 10 max-complexity = 10
.. note::
If you're using Python 2, you will notice that we download the
:mod:`configparser` backport from PyPI. That backport enables us to
support this behaviour on all supported versions of Python.
Please do **not** open issues about this dependency.
.. note:: .. note::
You can also specify ``--max-complexity`` as ``max_complexity = 10``. You can also specify ``--max-complexity`` as ``max_complexity = 10``.

View file

@ -1,13 +1,9 @@
"""Config handling logic for Flake8.""" """Config handling logic for Flake8."""
import configparser
import logging import logging
import os.path import os.path
import sys import sys
if sys.version_info < (3, 0):
import ConfigParser as configparser
else:
import configparser
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
__all__ = ('ConfigFileFinder', 'MergedConfigParser') __all__ = ('ConfigFileFinder', 'MergedConfigParser')

View file

@ -7,6 +7,7 @@ universal=1
[metadata] [metadata]
requires-dist = requires-dist =
enum34; python_version<"3.4" enum34; python_version<"3.4"
configparser; python_version<"3.2"
[pytest] [pytest]
norecursedirs = .git .* *.egg* old docs dist build norecursedirs = .git .* *.egg* old docs dist build

View file

@ -31,7 +31,7 @@ if mock is None:
requires = [ requires = [
"pyflakes >= 0.8.1, < 1.1", "pyflakes >= 0.8.1, < 1.1",
"pep8 >= 1.5.7, != 1.6.0, != 1.6.1, != 1.6.2", "pep8 >= 1.5.7, != 1.6.0, != 1.6.1, != 1.6.2",
# "mccabe >= 0.2.1, < 0.4", "mccabe >= 0.2.1, < 0.4",
] ]
if sys.version_info < (3, 4): if sys.version_info < (3, 4):

View file

@ -1,9 +1,5 @@
"""Tests for the ConfigFileFinder.""" """Tests for the ConfigFileFinder."""
try:
import ConfigParser as configparser
except ImportError:
import configparser import configparser
import os import os
import sys import sys

View file

@ -6,6 +6,7 @@ envlist = py27,py33,py34,py35,flake8
deps = deps =
mock mock
pytest pytest
py27: configparser
commands = commands =
py.test {posargs} py.test {posargs}