* [gentoo-commits] repo/gentoo:master commit in: media-gfx/xdot/, media-gfx/xdot/files/
@ 2022-10-30 9:35 Sam James
0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2022-10-30 9:35 UTC (permalink / raw
To: gentoo-commits
commit: 7c03e29ee878fea8283373764506032386552d19
Author: Matoro Mahri <matoro <AT> users <DOT> noreply <DOT> github <DOT> com>
AuthorDate: Thu Oct 6 02:58:53 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Oct 30 09:33:28 2022 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7c03e29e
media-gfx/xdot: add tests
Bug: https://bugs.gentoo.org/873490
Signed-off-by: Matoro Mahri <matoro <AT> users.noreply.github.com>
Closes: https://github.com/gentoo/gentoo/pull/27653
Signed-off-by: Sam James <sam <AT> gentoo.org>
.../xdot/files/backport-2ace1a1-issue-92.patch | 151 +++++++++++++++++++++
.../xdot/{xdot-9999.ebuild => xdot-1.2-r1.ebuild} | 17 ++-
media-gfx/xdot/xdot-9999.ebuild | 12 +-
3 files changed, 176 insertions(+), 4 deletions(-)
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 <jose.r.fonseca@gmail.com>
+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 <http://www.gnu.org/licenses/>.
+ #
+ 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<version>.*) \(.*\)$', 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-9999.ebuild b/media-gfx/xdot/xdot-1.2-r1.ebuild
similarity index 66%
copy from media-gfx/xdot/xdot-9999.ebuild
copy to media-gfx/xdot/xdot-1.2-r1.ebuild
index 646fd464d2bd..579a8e03216a 100644
--- a/media-gfx/xdot/xdot-9999.ebuild
+++ b/media-gfx/xdot/xdot-1.2-r1.ebuild
@@ -2,7 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
EAPI=7
-PYTHON_COMPAT=( python3_{8..11} )
+PYTHON_COMPAT=( python3_{8..10} )
MY_PN=xdot.py
EGIT_REPO_URI="https://github.com/jrfonseca/${MY_PN}"
@@ -11,24 +11,35 @@ if [[ ${PV} = 9999* ]]; then
GIT_ECLASS="git-r3"
SRC_URI=""
else
- KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~ppc ~ppc64 ~x86"
+ 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
+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
+}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: media-gfx/xdot/, media-gfx/xdot/files/
@ 2023-11-08 18:49 Matt Turner
0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2023-11-08 18:49 UTC (permalink / raw
To: gentoo-commits
commit: b40b46c37af84c1714e668b06d2df6e0928d6cb2
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Nov 8 18:48:15 2023 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Nov 8 18:49:38 2023 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b40b46c3
media-gfx/xdot: Drop old versions
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
media-gfx/xdot/Manifest | 1 -
.../xdot/files/backport-2ace1a1-issue-92.patch | 151 ---------------------
media-gfx/xdot/xdot-1.2-r1.ebuild | 45 ------
3 files changed, 197 deletions(-)
diff --git a/media-gfx/xdot/Manifest b/media-gfx/xdot/Manifest
index c0ad442da31e..c9d87a4a1fbe 100644
--- a/media-gfx/xdot/Manifest
+++ b/media-gfx/xdot/Manifest
@@ -1,2 +1 @@
-DIST xdot-1.2.tar.gz 136057 BLAKE2B 484a3513ec3d67dbc6e167f171e7f70977ba2472766f25aa7cc088235f99470bfac5fac67368ea53b633320752a928634840ff3dcccc6b96795d3b7c203db922 SHA512 b4d3b15114b982c7c38cc71c0602f6d1ba9874c7315c2b8c4a8a48bf7674e9b38bf19a0d4a2d319acc9a29cf8f177a651d4e213761e88b0b3cb26e95e8a92dda
DIST xdot-1.3.tar.gz 144187 BLAKE2B 38e89a8c47dd519a79221634ed3e451cc5ba9c0448545802561e92876c06af599b3327d2ab808d5f81842826baddc42d3921da9c6885a2b6485e39c79de80c9f SHA512 8d66a64182970b968adbb5031d17f0b2b3709d4daa0f6d32ba0e3616177be1e43bcaa62a3133a3a0d92f8468dbc12147918d04b5d543b94b5df6d39b7af31e17
diff --git a/media-gfx/xdot/files/backport-2ace1a1-issue-92.patch b/media-gfx/xdot/files/backport-2ace1a1-issue-92.patch
deleted file mode 100644
index 8cb76a43fe55..000000000000
--- a/media-gfx/xdot/files/backport-2ace1a1-issue-92.patch
+++ /dev/null
@@ -1,151 +0,0 @@
-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 <jose.r.fonseca@gmail.com>
-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 <http://www.gnu.org/licenses/>.
- #
- 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<version>.*) \(.*\)$', 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
deleted file mode 100644
index 32e4f34fbe3a..000000000000
--- a/media-gfx/xdot/xdot-1.2-r1.ebuild
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 1999-2023 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-PYTHON_COMPAT=( python3_{9..11} )
-
-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="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ppc ppc64 ~riscv ~s390 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[X] )
-"
-RDEPEND="${DEPEND}"
-
-run_test() {
- cd tests && "${EPYTHON}" ../test.py *.dot graphs/*.gv
- return "${?}"
-}
-
-python_test() {
- virtx run_test
-}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-11-08 18:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08 18:49 [gentoo-commits] repo/gentoo:master commit in: media-gfx/xdot/, media-gfx/xdot/files/ Matt Turner
-- strict thread matches above, loose matches on Subject: below --
2022-10-30 9:35 Sam James
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox