jenkins-bot has submitted this change. (
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1235555?usp=email )
Change subject: IMPR: Show a gracefull warning if Graphviz is not installed
......................................................................
IMPR: Show a gracefull warning if Graphviz is not installed
The Graphviz visualization software is not a Python package and must
be installed first. Show a gracefull warning if this software is not
installed.
Bug: T346008
Change-Id: I1d247c69ee287a637308a1dce0823a40038a20f6
---
M scripts/category_graph.py
1 file changed, 11 insertions(+), 2 deletions(-)
Approvals:
jenkins-bot: Verified
Xqt: Looks good to me, approved
diff --git a/scripts/category_graph.py b/scripts/category_graph.py
index 0a8f8ab..1c5148d 100755
--- a/scripts/category_graph.py
+++ b/scripts/category_graph.py
@@ -23,6 +23,9 @@
-downsize K font size divider for subcategories. 4 by default Use 1
for the same font size
+.. attention::
+ Beside ``pydot`` package the Graphviz visualization software must be
+ installed. Download it from https://www.graphviz.org/download/.
.. seealso:: https://graphviz.org/doc/info/attrs.html
for graphviz style definitions.
@@ -43,7 +46,7 @@
.. versionadded:: 8.0
"""
#
-# (C) Pywikibot team, 2022-2025
+# (C) Pywikibot team, 2022-2026
#
# Distributed under the terms of the MIT license.
#
@@ -195,7 +198,13 @@
pywikibot.info(self.to + '.gv')
self.dot.write(self.to + '.gv', encoding='utf-8')
pywikibot.info(self.to + '.svg')
- self.dot.write_svg(self.to + '.svg', encoding='utf-8')
+ try:
+ self.dot.write_svg(self.to + '.svg', encoding='utf-8')
+ except FileNotFoundError as e:
+ pywikibot.error(f'{e}\nThe Graphviz visualization software must'
+ ' be installed first.\nDownload it from'
+ ' https://www.graphviz.org/download/')
+ return
pywikibot.info(self.to + '.html')
header = ('<head><meta charset="UTF-8"/>'
--
To view, visit
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/1235555?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.wikimedia.org/r/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1d247c69ee287a637308a1dce0823a40038a20f6
Gerrit-Change-Number: 1235555
Gerrit-PatchSet: 4
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Enag2000 <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
Pywikibot-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]