From: Akira Yokosawa <akiyks@gmail.com>
To: Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
Akira Yokosawa <akiyks@gmail.com>
Subject: [PATCH 3/3] docs: sphinx/kfigure.py: Redirect warnings from inkscape to /dev/null
Date: Sun, 12 Dec 2021 17:03:33 +0900 [thread overview]
Message-ID: <11d1e898-7f22-b72f-4466-31faabb9100c@gmail.com> (raw)
In-Reply-To: <de8def13-efbc-1d98-acb5-5cc1f6902e4b@gmail.com>
Depending on its version, distro config, and system-setup type,
inkscape(1) emits various warning messages which are harmless in
command-line uses.
List of such warning messages (incomplete, long ones wrapped):
o Gtk-Message: hh:mm:ss.nnn: Failed to load module "canberra-gtk-module"
o Unable to init server: Could not connect: Connection refused
o Failed to get connection
o ** (inkscape:xxx): CRITICAL **: hh:mm:ss.nnn: dbus_g_proxy_new_for_name:
assertion 'connection != NULL' failed
o ** (inkscape:xxx): CRITICAL **: hh:mm:ss.nnn: dbus_g_proxy_call:
assertion 'DBUS_IS_G_PROXY (proxy)' failed
o ** (inkscape:xxx): CRITICAL **: hh:mm:ss.nnn: dbus_g_connection_register_g_object:
assertion 'connection != NULL' failed
o ** (inkscape:xxx): WARNING **: hh:mm:ss.nnn:
Fonts dir '/usr/share/inkscape/fonts' does not exist and will be ignored.
To avoid unnecessary anxiety, redirect warning messages from inkscape(1)
to /dev/null by default.
The redirection can be disabled by setting SPHINX_SHOW_INKSCAPE_WARN, e.g.,:
make SPHINX_SHOW_INKSCAPE_WARN=1 pdfdocs
Signed-off-by: Akira Yokosawa <akiyks@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
---
Documentation/sphinx/kfigure.py | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/Documentation/sphinx/kfigure.py b/Documentation/sphinx/kfigure.py
index 8d7c59e52ceb..d5802e3975e5 100644
--- a/Documentation/sphinx/kfigure.py
+++ b/Documentation/sphinx/kfigure.py
@@ -124,6 +124,9 @@ rsvg_convert_cmd = None
inkscape_cmd = None
# Inkscape prior to 1.0 uses different command options
inkscape_ver_one = False
+# Show warning from inkscape(1), enabled by setting env var
+# SPHINX_SHOW_INKSCAPE_WARN
+inkscape_show_warn = False
def setup(app):
@@ -173,7 +176,7 @@ def setupTools(app):
This function is called once, when the builder is initiated.
"""
global dot_cmd, convert_cmd, rsvg_convert_cmd # pylint: disable=W0603
- global inkscape_cmd, inkscape_ver_one # pylint: disable=W0603
+ global inkscape_cmd, inkscape_ver_one, inkscape_show_warn # pylint: disable=W0603
kernellog.verbose(app, "kfigure: check installed tools ...")
dot_cmd = which('dot')
@@ -188,12 +191,19 @@ def setupTools(app):
"graphviz from https://www.graphviz.org")
if inkscape_cmd:
kernellog.verbose(app, "use inkscape(1) from: " + inkscape_cmd)
- inkscape_ver = subprocess.check_output([inkscape_cmd, '--version'])
+ inkscape_ver = subprocess.check_output([inkscape_cmd, '--version'],
+ stderr=subprocess.DEVNULL)
ver_one_ptn = b'Inkscape 1'
inkscape_ver_one = re.search(ver_one_ptn, inkscape_ver)
convert_cmd = None
rsvg_convert_cmd = None
+ try:
+ if os.environ['SPHINX_SHOW_INKSCAPE_WARN']:
+ inkscape_show_warn = True
+ except KeyError:
+ pass
+
else:
if convert_cmd:
kernellog.verbose(app, "use convert(1) from: " + convert_cmd)
@@ -360,7 +370,11 @@ def svg2pdf(app, svg_fname, pdf_fname):
cmd = [inkscape_cmd, '-z', '--export-pdf=%s' % pdf_fname, svg_fname]
# use stdout and stderr from parent
- exit_code = subprocess.call(cmd)
+ if inkscape_show_warn:
+ exit_code = subprocess.call(cmd)
+ else:
+ exit_code = subprocess.call(cmd, stderr=subprocess.DEVNULL)
+
if exit_code != 0:
kernellog.warn(app, "Error #%d when calling: %s" % (exit_code, " ".join(cmd)))
return bool(exit_code == 0)
--
2.17.1
next prev parent reply other threads:[~2021-12-12 8:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-12 7:59 [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF Akira Yokosawa
2021-12-12 8:01 ` [PATCH 1/3] docs: sphinx/kfigure.py: Use rsvg-convert(1) for DOT -> PDF conversion Akira Yokosawa
2021-12-12 8:02 ` [PATCH 2/3] docs: sphinx/kfigure.py: Use inkscape(1) for SVG " Akira Yokosawa
2021-12-12 8:03 ` Akira Yokosawa [this message]
2021-12-12 10:38 ` [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF Mauro Carvalho Chehab
2021-12-12 11:57 ` Akira Yokosawa
2021-12-13 6:33 ` Mauro Carvalho Chehab
2021-12-13 7:53 ` Akira Yokosawa
2021-12-29 12:54 ` Status of selection.svg update (was Re: [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF) Akira Yokosawa
2021-12-29 22:14 ` Mauro Carvalho Chehab
2021-12-30 2:09 ` Akira Yokosawa
2021-12-13 14:36 ` [PATCH 4/3] docs: sphinx/kfigure.py: Add check of 'dot -Tpdf' Akira Yokosawa
2021-12-14 2:34 ` [PATCH 5/3] docs: sphinx/kfigure.py: Delegate inkscape msgs to kernellog Akira Yokosawa
2021-12-14 2:50 ` Randy Dunlap
2021-12-14 3:14 ` Akira Yokosawa
2021-12-23 19:56 ` [PATCH 0/3] docs: sphinx/kfigure.py: Improve conversion to PDF Jonathan Corbet
2021-12-23 21:52 ` Akira Yokosawa
2021-12-23 23:48 ` Jonathan Corbet
2021-12-24 1:53 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=11d1e898-7f22-b72f-4466-31faabb9100c@gmail.com \
--to=akiyks@gmail.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.