From c9388864702fdd7b0b56c049eddb41bdb9054dcb Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 30 Oct 2022 15:03:33 +0000 Subject: gentoo auto-resync : 30:10:2022 - 15:03:33 --- media-gfx/xdot/Manifest | 4 +- .../xdot/files/backport-2ace1a1-issue-92.patch | 151 +++++++++++++++++++++ media-gfx/xdot/xdot-1.2-r1.ebuild | 45 ++++++ media-gfx/xdot/xdot-9999.ebuild | 12 +- 4 files changed, 210 insertions(+), 2 deletions(-) create mode 100644 media-gfx/xdot/files/backport-2ace1a1-issue-92.patch create mode 100644 media-gfx/xdot/xdot-1.2-r1.ebuild (limited to 'media-gfx/xdot') diff --git a/media-gfx/xdot/Manifest b/media-gfx/xdot/Manifest index af0a6fad65d3..98020f5c4fcc 100644 --- a/media-gfx/xdot/Manifest +++ b/media-gfx/xdot/Manifest @@ -1,4 +1,6 @@ +AUX backport-2ace1a1-issue-92.patch 5161 BLAKE2B a2974216dd5bfb64a53033f1a587a8d05181e3b894c3f5bbece7f3ec40014d38ee9185b8fb500dab78668319e1c91a9b8213a326a2df3ba6b347698082ed854f SHA512 58129ae687b0a8d78c0deb189519dbe3dd8b55484b3b9a6455f2bb0f607fcc5c43992ca6c841eadc576af46fac9f9ba5fb42f14b089c8864e60588ee72189ccb DIST xdot-1.2.tar.gz 136057 BLAKE2B 484a3513ec3d67dbc6e167f171e7f70977ba2472766f25aa7cc088235f99470bfac5fac67368ea53b633320752a928634840ff3dcccc6b96795d3b7c203db922 SHA512 b4d3b15114b982c7c38cc71c0602f6d1ba9874c7315c2b8c4a8a48bf7674e9b38bf19a0d4a2d319acc9a29cf8f177a651d4e213761e88b0b3cb26e95e8a92dda +EBUILD xdot-1.2-r1.ebuild 1039 BLAKE2B 4015ceadbe0fcedeade4f994e8fc90c5639a49491128686ef0f98cae01529b146cddb37f02d815e54ef4cf95cbe9199a6a2a93f143e8e34add13758a081fc9b3 SHA512 9d21e6230c7894f2404f7f143d6f09e142d241763d78c349e47af2b41bbd2c08272a97738e7f4e840f1835cbde068cbf42b2bf21c3dbed99e953a9ad7ed75530 EBUILD xdot-1.2.ebuild 823 BLAKE2B 60d0ee6a4e0c5777eac2a713f1d2608ba27691fad256a46891223c7c77b90d53466ccc895ec6b6178abc408fdc951e3b662050695d73dc96c9cdec480dfb3a94 SHA512 ab8287df54a6a0ddc140e4ed2234ea151c3ac977440f364c9577f5b5b9c68234a2f61e9a26bd032910b145cdb5cdd0c902bfc2a0136223dea7f7ddfaf8de80e3 -EBUILD xdot-9999.ebuild 809 BLAKE2B b50239dfe4178177e415fcea894956b297c8c6f870f0c420e16bf78657b5f503bee68dcea78be40f790e03bbae2395f4b878cd0aa39b5312fca8afb159e51fff SHA512 ccb5ec7f3e405489fdc63c0ba15e8da1644ec7f73b60a2979d04c2283dd8d6d39fbb76e9f8606102e69bc58bc79b3317d57cb07f7f3ad77ee2fcc5362bee4b3b +EBUILD xdot-9999.ebuild 966 BLAKE2B d8e39cf4c6e592a7adeaedff68cee76f5b7dc5de846508f7b26f7a8ea1b664c19bf6c1b6455e9013e1205f805db5b6ab61edbd42d3f256430bea01584f5e92d2 SHA512 1424ace30db00a6d1b3bea96305a8754d94ca3f589b9741f0c20c6215220cf666b1e5fcb8fb77a4eeb35e01497d2bba017996ab328d46b99ac0b17f159bdc924 MISC metadata.xml 399 BLAKE2B 06318ca9aa1bb3f53733542916d19d28c03133866e868aefeba88d7e6e1b7594a628488471fe7f6853e02402a14db8501e056f5df9ae1429c4eca66ab7b6a492 SHA512 16caf359c45841ae27bfdeee51c7fdd71d6282548773e6f519cbcbfe43f9fa39c65322a610d2b3d5cb4471129cfa3738e6ee66ff6b6e94b4263d918fd44ff30c diff --git a/media-gfx/xdot/files/backport-2ace1a1-issue-92.patch b/media-gfx/xdot/files/backport-2ace1a1-issue-92.patch new file mode 100644 index 000000000000..8cb76a43fe55 --- /dev/null +++ b/media-gfx/xdot/files/backport-2ace1a1-issue-92.patch @@ -0,0 +1,151 @@ +https://github.com/jrfonseca/xdot.py/issues/92 +https://bugs.gentoo.org/873490 + +From 2ace1a12d78423d9e7af20fdb0bca34827010408 Mon Sep 17 00:00:00 2001 +From: Jose Fonseca +Date: Tue, 28 Sep 2021 13:19:49 +0100 +Subject: [PATCH] Handle xdot backslashes correctly. + +Irrespectively of graphviz version. + +Fixes https://github.com/jrfonseca/xdot.py/issues/92 +--- + tests/issue_92_a.dot | 3 +++ + tests/issue_92_b.dot | 3 +++ + xdot/dot/parser.py | 26 +++++++++++++++++++++----- + xdot/ui/window.py | 11 ++++++++++- + 4 files changed, 37 insertions(+), 6 deletions(-) + create mode 100644 tests/issue_92_a.dot + create mode 100644 tests/issue_92_b.dot + +diff --git a/tests/issue_92_a.dot b/tests/issue_92_a.dot +new file mode 100644 +index 0000000..ea486b0 +--- /dev/null ++++ b/tests/issue_92_a.dot +@@ -0,0 +1,3 @@ ++digraph { ++ 1 [label="a\\00"] ++} +diff --git a/tests/issue_92_b.dot b/tests/issue_92_b.dot +new file mode 100644 +index 0000000..ba90566 +--- /dev/null ++++ b/tests/issue_92_b.dot +@@ -0,0 +1,3 @@ ++digraph { ++ 1 [label="a\\b"] ++} +diff --git a/xdot/dot/parser.py b/xdot/dot/parser.py +index 4244e03..6578c23 100644 +--- a/xdot/dot/parser.py ++++ b/xdot/dot/parser.py +@@ -14,8 +14,11 @@ + # along with this program. If not, see . + # + import colorsys ++import re + import sys + ++from distutils.version import LooseVersion ++ + from .lexer import ParseError, DotLexer + + from ..ui.colors import lookup_color +@@ -85,7 +88,14 @@ class XDotAttrParser: + - http://www.graphviz.org/doc/info/output.html#d:xdot + """ + +- def __init__(self, parser, buf): ++ def __init__(self, parser, buf, broken_backslashes): ++ ++ # `\` should be escaped as `\\`, but older versions of graphviz xdot ++ # output failed to properly escape it. See also ++ # https://github.com/jrfonseca/xdot.py/issues/92 ++ if not broken_backslashes: ++ buf = re.sub(br'\\(.)', br'\1', buf) ++ + self.parser = parser + self.buf = buf + self.pos = 0 +@@ -427,10 +437,16 @@ class XDotParser(DotParser): + + XDOTVERSION = '1.7' + +- def __init__(self, xdotcode): ++ def __init__(self, xdotcode, graphviz_version=None): + lexer = DotLexer(buf=xdotcode) + DotParser.__init__(self, lexer) + ++ # https://github.com/jrfonseca/xdot.py/issues/92 ++ self.broken_backslashes = False ++ if graphviz_version is not None and \ ++ LooseVersion(graphviz_version) < LooseVersion("2.46.0"): ++ self.broken_backslashes = True ++ + self.nodes = [] + self.edges = [] + self.shapes = [] +@@ -480,7 +496,7 @@ def handle_graph(self, attrs): + + for attr in ("_draw_", "_ldraw_", "_hdraw_", "_tdraw_", "_hldraw_", "_tldraw_"): + if attr in attrs: +- parser = XDotAttrParser(self, attrs[attr]) ++ parser = XDotAttrParser(self, attrs[attr], self.broken_backslashes) + self.shapes.extend(parser.parse()) + + def handle_node(self, id, attrs): +@@ -502,7 +518,7 @@ def handle_node(self, id, attrs): + shapes = [] + for attr in ("_draw_", "_ldraw_"): + if attr in attrs: +- parser = XDotAttrParser(self, attrs[attr]) ++ parser = XDotAttrParser(self, attrs[attr], self.broken_backslashes) + shapes.extend(parser.parse()) + try: + url = attrs['URL'] +@@ -525,7 +541,7 @@ def handle_edge(self, src_id, dst_id, attrs): + shapes = [] + for attr in ("_draw_", "_ldraw_", "_hdraw_", "_tdraw_", "_hldraw_", "_tldraw_"): + if attr in attrs: +- parser = XDotAttrParser(self, attrs[attr]) ++ parser = XDotAttrParser(self, attrs[attr], self.broken_backslashes) + shapes.extend(parser.parse()) + if shapes: + src = self.node_by_name[src_id] +diff --git a/xdot/ui/window.py b/xdot/ui/window.py +index 893bd1d..e27f000 100644 +--- a/xdot/ui/window.py ++++ b/xdot/ui/window.py +@@ -56,6 +56,7 @@ class DotWidget(Gtk.DrawingArea): + } + + filter = 'dot' ++ graphviz_version = None + + def __init__(self): + Gtk.DrawingArea.__init__(self) +@@ -100,6 +101,7 @@ def error_dialog(self, message): + + def set_filter(self, filter): + self.filter = filter ++ self.graphviz_version = None + + def run_filter(self, dotcode): + if not self.filter: +@@ -153,7 +155,14 @@ def set_dotcode(self, dotcode, filename=None, center=True): + + def set_xdotcode(self, xdotcode, center=True): + assert isinstance(xdotcode, bytes) +- parser = XDotParser(xdotcode) ++ if self.graphviz_version is None: ++ stdout = subprocess.check_output([self.filter, '-V'], stderr=subprocess.STDOUT) ++ stdout = stdout.rstrip() ++ mo = re.match(br'^.* - .* version (?P.*) \(.*\)$', stdout) ++ assert mo ++ self.graphviz_version = mo.group('version').decode('ascii') ++ ++ parser = XDotParser(xdotcode, graphviz_version=self.graphviz_version) + self.graph = parser.parse() + self.zoom_image(self.zoom_ratio, center=center) + diff --git a/media-gfx/xdot/xdot-1.2-r1.ebuild b/media-gfx/xdot/xdot-1.2-r1.ebuild new file mode 100644 index 000000000000..579a8e03216a --- /dev/null +++ b/media-gfx/xdot/xdot-1.2-r1.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 +PYTHON_COMPAT=( python3_{8..10} ) + +MY_PN=xdot.py +EGIT_REPO_URI="https://github.com/jrfonseca/${MY_PN}" + +if [[ ${PV} = 9999* ]]; then + GIT_ECLASS="git-r3" + SRC_URI="" +else + KEYWORDS="amd64 arm arm64 ~hppa ~ia64 ppc ~ppc64 ~riscv ~sparc x86" + MY_P="${MY_PN}-${PV}" + S="${WORKDIR}/${MY_P}" + SRC_URI="https://github.com/jrfonseca/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" +fi + +inherit ${GIT_ECLASS} distutils-r1 virtualx + +DESCRIPTION="Interactive viewer for Graphviz dot files" +HOMEPAGE="https://github.com/jrfonseca/xdot.py" + +LICENSE="LGPL-2+" +SLOT="0" +PATCHES=( "${FILESDIR}/backport-2ace1a1-issue-92.patch" ) + +DEPEND=" + dev-python/numpy[${PYTHON_USEDEP}] + dev-python/pycairo[${PYTHON_USEDEP}] + dev-python/pygobject:3[${PYTHON_USEDEP}] + media-gfx/graphviz + test? ( x11-libs/gtk+:3 ) +" +RDEPEND="${DEPEND}" + +run_test() { + cd tests && "${EPYTHON}" ../test.py *.dot graphs/*.gv + return "${?}" +} + +python_test() { + virtx run_test +} diff --git a/media-gfx/xdot/xdot-9999.ebuild b/media-gfx/xdot/xdot-9999.ebuild index 646fd464d2bd..b0e3b6d5c63e 100644 --- a/media-gfx/xdot/xdot-9999.ebuild +++ b/media-gfx/xdot/xdot-9999.ebuild @@ -17,7 +17,7 @@ else SRC_URI="https://github.com/jrfonseca/${MY_PN}/archive/${PV}.tar.gz -> ${P}.tar.gz" fi -inherit ${GIT_ECLASS} distutils-r1 +inherit ${GIT_ECLASS} distutils-r1 virtualx DESCRIPTION="Interactive viewer for Graphviz dot files" HOMEPAGE="https://github.com/jrfonseca/xdot.py" @@ -30,5 +30,15 @@ DEPEND=" dev-python/pycairo[${PYTHON_USEDEP}] dev-python/pygobject:3[${PYTHON_USEDEP}] media-gfx/graphviz + test? ( x11-libs/gtk+:3 ) " RDEPEND="${DEPEND}" + +run_test() { + cd tests && "${EPYTHON}" ../test.py *.dot graphs/*.gv + return "${?}" +} + +python_test() { + virtx run_test +} -- cgit v1.2.3