summaryrefslogtreecommitdiff
path: root/pep8.py
diff options
context:
space:
mode:
authorIan Lee <IanLee1521@gmail.com>2015-03-17 21:52:23 -0700
committerIan Lee <IanLee1521@gmail.com>2015-03-17 21:55:36 -0700
commit435d1cbf995a659a82d1d4b42d25e3459556ef21 (patch)
treeaec957ffb0c49b3cab0d0d7622837a735939850b /pep8.py
parentf6fe8ac6e29a0395ce53416f98a10a8720bd43d2 (diff)
downloadpep8-435d1cbf995a659a82d1d4b42d25e3459556ef21.tar.gz
Reverted fix for #368 which had unintended repurcussions in flake8 and other places.
This fix reverts to the parsing of user config (~/.config/pep8), then local directory config files, and finally overrides with cli options as was the behavior back in 1.5.7
Diffstat (limited to 'pep8.py')
-rwxr-xr-xpep8.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/pep8.py b/pep8.py
index 9f40381..4d993da 100755
--- a/pep8.py
+++ b/pep8.py
@@ -1984,24 +1984,24 @@ def read_config(options, args, arglist, parser):
local_dir = os.curdir
+ if USER_CONFIG and os.path.isfile(USER_CONFIG):
+ if options.verbose:
+ print('user configuration: %s' % USER_CONFIG)
+ config.read(USER_CONFIG)
+
+ parent = tail = args and os.path.abspath(os.path.commonprefix(args))
+ while tail:
+ if config.read(os.path.join(parent, fn) for fn in PROJECT_CONFIG):
+ local_dir = parent
+ if options.verbose:
+ print('local configuration: in %s' % parent)
+ break
+ (parent, tail) = os.path.split(parent)
+
if cli_conf and os.path.isfile(cli_conf):
if options.verbose:
print('cli configuration: %s' % cli_conf)
config.read(cli_conf)
- else:
- if USER_CONFIG and os.path.isfile(USER_CONFIG):
- if options.verbose:
- print('user configuration: %s' % USER_CONFIG)
- config.read(USER_CONFIG)
-
- parent = tail = args and os.path.abspath(os.path.commonprefix(args))
- while tail:
- if config.read(os.path.join(parent, fn) for fn in PROJECT_CONFIG):
- local_dir = parent
- if options.verbose:
- print('local configuration: in %s' % parent)
- break
- (parent, tail) = os.path.split(parent)
pep8_section = parser.prog
if config.has_section(pep8_section):