From 2968ef3c2656c0ba3a81c28e430a44cf67921414 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Thu, 9 Feb 2017 12:55:07 +0900 Subject: [PATCH] Fix #3402: Allow to suppress "download file not readable" warnings using ``suppress_warnings`` --- CHANGES | 2 ++ doc/config.rst | 2 ++ sphinx/environment/collectors/asset.py | 6 +++--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index c3f6e2852e..05bf86137c 100644 --- a/CHANGES +++ b/CHANGES @@ -46,6 +46,8 @@ Features added * #3303: Add ``:pyversion:`` option to the doctest directive. * #3378: (latex) support for ``:widths:`` option of table directives (refs: #3379, #3381) +* #3402: Allow to suppress "download file not readable" warnings using + :confval:`suppress_warnings`. Bugs fixed ---------- diff --git a/doc/config.rst b/doc/config.rst index c082dba2fd..9b1079f471 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -226,8 +226,10 @@ General configuration * app.add_role * app.add_generic_role * app.add_source_parser + * download.not_readable * image.data_uri * image.nonlocal_uri + * image.not_readable * ref.term * ref.ref * ref.numref diff --git a/sphinx/environment/collectors/asset.py b/sphinx/environment/collectors/asset.py index 54283790c2..38deeeca4f 100644 --- a/sphinx/environment/collectors/asset.py +++ b/sphinx/environment/collectors/asset.py @@ -96,7 +96,7 @@ class ImageCollector(EnvironmentCollector): app.env.dependencies[docname].add(imgpath) if not os.access(path.join(app.srcdir, imgpath), os.R_OK): logger.warning('image file not readable: %s' % imgpath, - location=node) + location=node, type='image', subtype='not_readable') continue app.env.images.add_file(docname, imgpath) @@ -112,7 +112,7 @@ class ImageCollector(EnvironmentCollector): globbed.setdefault(mimetype, []).append(new_imgpath) except (OSError, IOError) as err: logger.warning('image file %s not readable: %s' % (filename, err), - location=node) + location=node, type='image', subtype='not_readable') for key, files in iteritems(globbed): candidates[key] = sorted(files, key=len)[0] # select by similarity @@ -137,7 +137,7 @@ class DownloadFileCollector(EnvironmentCollector): app.env.dependencies[app.env.docname].add(rel_filename) if not os.access(filename, os.R_OK): logger.warning('download file not readable: %s' % filename, - location=node) + location=node, type='download', subtype='not_readable') continue node['filename'] = app.env.dlfiles.add_file(app.env.docname, filename)