summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.txt4
-rw-r--r--docs/intro.rst6
-rwxr-xr-xpep8.py18
3 files changed, 13 insertions, 15 deletions
diff --git a/CHANGES.txt b/CHANGES.txt
index 4298702..774ace0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,10 @@ Changelog
* Honor ``# noqa`` for errors E711 and E712. (Issue #180)
+* When both a ``tox.ini`` and a ``setup.cfg`` are present in the project
+ directory, merge their contents. The ``tox.ini`` file takes
+ precedence (same as before). (Issue #182)
+
1.4.5 (2013-03-06)
------------------
diff --git a/docs/intro.rst b/docs/intro.rst
index c22df98..d73a3c8 100644
--- a/docs/intro.rst
+++ b/docs/intro.rst
@@ -163,9 +163,9 @@ Example::
ignore = E226,E302,E41
max-line-length = 160
-At the project level, a ``.pep8`` file, a ``tox.ini`` file or a ``setup.cfg``
-file is read if present. Only the first file is considered. If this file
-does not have a ``[pep8]`` section, no project specific configuration is
+At the project level, a ``tox.ini`` file or a ``setup.cfg`` file is read if
+present (``.pep8`` file is also supported, but it is deprecated). If none of
+these files have a ``[pep8]`` section, no project specific configuration is
loaded.
If the ``ignore`` option is not in the configuration and not in the arguments,
diff --git a/pep8.py b/pep8.py
index e1ec9e3..888df59 100755
--- a/pep8.py
+++ b/pep8.py
@@ -69,7 +69,7 @@ if sys.platform == 'win32':
else:
DEFAULT_CONFIG = os.path.join(os.getenv('XDG_CONFIG_HOME') or
os.path.expanduser('~/.config'), 'pep8')
-PROJECT_CONFIG = ('.pep8', 'tox.ini', 'setup.cfg')
+PROJECT_CONFIG = ('setup.cfg', 'tox.ini', '.pep8')
TESTSUITE_PATH = os.path.join(os.path.dirname(__file__), 'testsuite')
MAX_LINE_LENGTH = 79
REPORT_FORMAT = {
@@ -1742,17 +1742,11 @@ def read_config(options, args, arglist, parser):
parent = tail = args and os.path.abspath(os.path.commonprefix(args))
while tail:
- for name in PROJECT_CONFIG:
- local_conf = os.path.join(parent, name)
- if os.path.isfile(local_conf):
- break
- else:
- parent, tail = os.path.split(parent)
- continue
- if options.verbose:
- print('local configuration: %s' % local_conf)
- config.read(local_conf)
- break
+ if config.read([os.path.join(parent, fn) for fn in PROJECT_CONFIG]):
+ 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):