summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-05-30 12:44:58 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-05-30 12:51:31 -0500
commit33f982b446aa1698dcc53d3cd6277f387c79b7a3 (patch)
tree11b6b204bfe57a107738f6ab1c456c93dc77ad10
parente9ddf7533b7bbe142a5450c41f667fb1115b9262 (diff)
downloadflake8-33f982b446aa1698dcc53d3cd6277f387c79b7a3.tar.gz
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
-rw-r--r--docs/source/user/configuration.rst8
-rw-r--r--flake8/options/config.py6
-rw-r--r--setup.cfg1
-rw-r--r--setup.py2
-rw-r--r--tests/unit/test_config_file_finder.py6
-rw-r--r--tox.ini1
6 files changed, 13 insertions, 11 deletions
diff --git a/docs/source/user/configuration.rst b/docs/source/user/configuration.rst
index eb9054d..6a176ec 100644
--- a/docs/source/user/configuration.rst
+++ b/docs/source/user/configuration.rst
@@ -157,6 +157,14 @@ This would allow us to add comments for why we're excluding items, e.g.,
.. 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::
+
You can also specify ``--max-complexity`` as ``max_complexity = 10``.
This is also useful if you have a long list of error codes to ignore. Let's
diff --git a/flake8/options/config.py b/flake8/options/config.py
index ecc40f7..9bd7e19 100644
--- a/flake8/options/config.py
+++ b/flake8/options/config.py
@@ -1,13 +1,9 @@
"""Config handling logic for Flake8."""
+import configparser
import logging
import os.path
import sys
-if sys.version_info < (3, 0):
- import ConfigParser as configparser
-else:
- import configparser
-
LOG = logging.getLogger(__name__)
__all__ = ('ConfigFileFinder', 'MergedConfigParser')
diff --git a/setup.cfg b/setup.cfg
index 8af25a3..831bd62 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -7,6 +7,7 @@ universal=1
[metadata]
requires-dist =
enum34; python_version<"3.4"
+ configparser; python_version<"3.2"
[pytest]
norecursedirs = .git .* *.egg* old docs dist build
diff --git a/setup.py b/setup.py
index c090263..8e789d0 100644
--- a/setup.py
+++ b/setup.py
@@ -31,7 +31,7 @@ if mock is None:
requires = [
"pyflakes >= 0.8.1, < 1.1",
"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):
diff --git a/tests/unit/test_config_file_finder.py b/tests/unit/test_config_file_finder.py
index 58009f7..8d7e920 100644
--- a/tests/unit/test_config_file_finder.py
+++ b/tests/unit/test_config_file_finder.py
@@ -1,9 +1,5 @@
"""Tests for the ConfigFileFinder."""
-try:
- import ConfigParser as configparser
-except ImportError:
- import configparser
-
+import configparser
import os
import sys
diff --git a/tox.ini b/tox.ini
index 24ef6e8..45514ea 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,6 +6,7 @@ envlist = py27,py33,py34,py35,flake8
deps =
mock
pytest
+ py27: configparser
commands =
py.test {posargs}