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.
This commit is contained in:
Takeshi KOMIYA 2019-02-23 20:31:59 +09:00
parent ac4ec47378
commit d9d5594c6f
3 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,9 @@ Dependencies
Incompatible changes Incompatible changes
-------------------- --------------------
* Ignore filenames without file extension given to ``Builder.build_specific()``
API directly
Deprecated Deprecated
---------- ----------

View File

@ -298,8 +298,7 @@ class Builder:
logger.warning(__('file %r given on command line is not under the ' logger.warning(__('file %r given on command line is not under the '
'source directory, ignoring'), filename) 'source directory, ignoring'), filename)
continue continue
if not (path.isfile(filename) or if not path.isfile(filename):
any(path.isfile(filename + suffix) for suffix in suffixes)):
logger.warning(__('file %r given on command line does not exist, ' logger.warning(__('file %r given on command line does not exist, '
'ignoring'), filename) 'ignoring'), filename)
continue continue

View File

@ -131,7 +131,7 @@ def test_build_specific(app):
app.srcdir / 'subdir/../subdir/excluded.txt'] # not normalized app.srcdir / 'subdir/../subdir/excluded.txt'] # not normalized
app.build(False, filenames) 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, app.builder.build.assert_called_with(expected,
method='specific', method='specific',
summary='5 source files given on command line') summary='4 source files given on command line')