summaryrefslogtreecommitdiff
path: root/src/flake8/options/manager.py
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-09 07:02:27 -0500
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-09 07:02:27 -0500
commitae794fb46a177c754071c7a36811893c8dedc710 (patch)
treecaf79ae1fc71c2f154b8d34c694f9aef6876acb4 /src/flake8/options/manager.py
parent45a57df5421c2e615888a70eae2783d3d075bf21 (diff)
downloadflake8-bug/163.tar.gz
Update setuptools integration for setup.cfgbug/163
When flake8's config is in setup.cfg, setuptools attempts to set those options on the command instance. If they don't exist, it fails early complaining that a specific option does not exist. This adds this back and does it better than the Flake8 2.x version. Closes #163
Diffstat (limited to 'src/flake8/options/manager.py')
-rw-r--r--src/flake8/options/manager.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/flake8/options/manager.py b/src/flake8/options/manager.py
index c6a3fcb..f9d9e26 100644
--- a/src/flake8/options/manager.py
+++ b/src/flake8/options/manager.py
@@ -133,6 +133,19 @@ class Option(object):
return utils.parse_comma_separated_list(value)
return value
+ def normalize_from_setuptools(self, value):
+ """Normalize the value received from setuptools."""
+ value = self.normalize(value)
+ if self.type == 'int' or self.action == 'count':
+ return int(value)
+ if self.action in ('store_true', 'store_false'):
+ value = str(value).upper()
+ if value in ('1', 'T', 'TRUE', 'ON'):
+ return True
+ if value in ('0', 'F', 'FALSE', 'OFF'):
+ return False
+ return value
+
def to_optparse(self):
"""Convert a Flake8 Option to an optparse Option."""
if self._opt is None: