summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan Cordasco <graffatcolmingov@gmail.com>2016-07-30 00:42:32 +0000
committerIan Cordasco <graffatcolmingov@gmail.com>2016-07-30 00:42:32 +0000
commitb02855769bcc89e9c9ad8aa84e6cfdf3fdac1f2e (patch)
tree609e22c5263c7d97cf39dec8b621b3edd70edee5 /src
parente619fd3b2095a4951ecd1cfceab195e6f501f8ee (diff)
parent63f5f15068ed7031b4375168392ca64a856083b6 (diff)
downloadflake8-b02855769bcc89e9c9ad8aa84e6cfdf3fdac1f2e.tar.gz
Merge branch 'bug/194' into 'master'
Re-allow for relative paths for exclude *Description of changes* Use the directory that the configuration file is found in as the parent (instead of the current working directory) when normalizing paths. *Related to:* #194 See merge request !109
Diffstat (limited to 'src')
-rw-r--r--src/flake8/options/config.py11
-rw-r--r--src/flake8/options/manager.py4
2 files changed, 10 insertions, 5 deletions
diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py
index d1408fe..8306251 100644
--- a/src/flake8/options/config.py
+++ b/src/flake8/options/config.py
@@ -43,6 +43,8 @@ class ConfigFileFinder(object):
# List of filenames to find in the local/project directory
self.project_filenames = ('setup.cfg', 'tox.ini', self.program_config)
+ self.local_directory = os.path.abspath(os.curdir)
+
if not args:
args = ['.']
self.parent = self.tail = os.path.abspath(os.path.commonprefix(args))
@@ -78,6 +80,7 @@ class ConfigFileFinder(object):
if os.path.exists(filename):
yield filename
found_config_files = True
+ self.local_directory = parent
(parent, tail) = os.path.split(parent)
def local_config_files(self):
@@ -160,9 +163,11 @@ class MergedConfigParser(object):
self.config_finder = ConfigFileFinder(self.program_name, self.args,
self.extra_config_files)
- @staticmethod
- def _normalize_value(option, value):
- final_value = option.normalize(value)
+ def _normalize_value(self, option, value):
+ final_value = option.normalize(
+ value,
+ self.config_finder.local_directory,
+ )
LOG.debug('%r has been normalized to %r for option "%s"',
value, final_value, option.config_name)
return final_value
diff --git a/src/flake8/options/manager.py b/src/flake8/options/manager.py
index 58d8b2d..de9356e 100644
--- a/src/flake8/options/manager.py
+++ b/src/flake8/options/manager.py
@@ -121,14 +121,14 @@ class Option(object):
return self.long_option_name[2:].replace('-', '_')
return self.short_option_name[1]
- def normalize(self, value):
+ def normalize(self, value, *normalize_args):
"""Normalize the value based on the option configuration."""
if self.normalize_paths:
# Decide whether to parse a list of paths or a single path
normalize = utils.normalize_path
if self.comma_separated_list:
normalize = utils.normalize_paths
- return normalize(value)
+ return normalize(value, *normalize_args)
elif self.comma_separated_list:
return utils.parse_comma_separated_list(value)
return value