From d9d5594c6f02e0e39337baace8fce750a8272980 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sat, 23 Feb 2019 20:31:59 +0900 Subject: [PATCH] Ignore filenames without file extension given to ``Builder.build_specific()`` So far, ``Builder.build_specific()`` accpets filnames without file extension. On the other hand, ``sphinx-build`` command does not accept such files. So the special handling code is only working for 3rd party applications. The behavior is not consistent. In addition, that is not helpful for users. This removes such behavior from builders. This does not change Sphinx application itself. It only effects to the applications which uses the API directly. --- CHANGES | 3 +++ sphinx/builders/__init__.py | 3 +-- tests/test_application.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 28e99a44d..6a4aa6eeb 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,9 @@ Dependencies Incompatible changes -------------------- +* Ignore filenames without file extension given to ``Builder.build_specific()`` + API directly + Deprecated ---------- diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 335880ef0..5cd5312fa 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -298,8 +298,7 @@ class Builder: logger.warning(__('file %r given on command line is not under the ' 'source directory, ignoring'), filename) continue - if not (path.isfile(filename) or - any(path.isfile(filename + suffix) for suffix in suffixes)): + if not path.isfile(filename): logger.warning(__('file %r given on command line does not exist, ' 'ignoring'), filename) continue diff --git a/tests/test_application.py b/tests/test_application.py index 1a4d41289..08c13c5cf 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -131,7 +131,7 @@ def test_build_specific(app): app.srcdir / 'subdir/../subdir/excluded.txt'] # not normalized app.build(False, filenames) - expected = ['index', 'images', 'img.png', 'subdir/includes', 'subdir/excluded'] + expected = ['index', 'img.png', 'subdir/includes', 'subdir/excluded'] app.builder.build.assert_called_with(expected, method='specific', - summary='5 source files given on command line') + summary='4 source files given on command line')