summaryrefslogtreecommitdiff
path: root/dev-python/pydot
diff options
context:
space:
mode:
authorPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
committerPalica <palica+gitlab@liguros.net>2020-06-23 22:35:08 +0200
commitecdac123787b96ce6649f0f91da12ea6458cc2b1 (patch)
treeb89c74d9e6fe6e8aebc4c77bcbeb4ab73214127d /dev-python/pydot
parent1be72aa41cf41dedadeecf59dca9f01de6381f5e (diff)
downloadbaldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.gz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.tar.xz
baldeagleos-repo-ecdac123787b96ce6649f0f91da12ea6458cc2b1.zip
Updating liguros repo
Diffstat (limited to 'dev-python/pydot')
-rw-r--r--dev-python/pydot/Manifest1
-rw-r--r--dev-python/pydot/files/pydot-1.4.1-unittest.patch74
-rw-r--r--dev-python/pydot/metadata.xml13
-rw-r--r--dev-python/pydot/pydot-1.4.1.ebuild36
4 files changed, 124 insertions, 0 deletions
diff --git a/dev-python/pydot/Manifest b/dev-python/pydot/Manifest
new file mode 100644
index 000000000000..9ff10b2684c3
--- /dev/null
+++ b/dev-python/pydot/Manifest
@@ -0,0 +1 @@
+DIST pydot-1.4.1.tar.gz 264987 BLAKE2B 61db2b6dbeab582981bf96054686c927d8d4548ac19a6c197ab1725f92c87e973c2dcd84d4c6c04cb2ca76b8f40814cfee1d5a53e4952065a538fc271e75d2a0 SHA512 b5f16b59908586df61cd415cb1a3e242fb69c39674a82b171862beff1f3727f47cba39bdd806901cb56bc8a6888783a53d112b1b70044e124ea992789d77f938
diff --git a/dev-python/pydot/files/pydot-1.4.1-unittest.patch b/dev-python/pydot/files/pydot-1.4.1-unittest.patch
new file mode 100644
index 000000000000..b3c0d0e426b5
--- /dev/null
+++ b/dev-python/pydot/files/pydot-1.4.1-unittest.patch
@@ -0,0 +1,74 @@
+From a10ced4d132361027a545a471af4541dea8c5cf5 Mon Sep 17 00:00:00 2001
+From: Peter Nowee <peter@peternowee.com>
+Date: Wed, 26 Jun 2019 15:43:38 +0800
+Subject: [PATCH] Fix multi.dot Graphviz regression test
+
+Commit d6602ad of 2018-12-01 fixed the regression test broken by commit
+2d55978 of 2016-07-01. This revealed that `test/graphs/multi.dot` was
+failing.
+
+`multi.dot` was introduced in commit 2b3f088 of 2010-11-07 together
+with many of the other tests still here today. It has not been touched
+since. It is a DOT-file containing two digraphs. The regression test
+compares the JPEG images rendered from the DOT-file by pydot with those
+rendered by Graphviz's dot directly.
+
+Commit 66734d2 of 2016-07-01 is the actual cause of the failure. It
+changed one of the render methods of the regression test,
+`_render_with_pydot`, from calculating a single hash for all the JPEG
+images to calculating separate hashes for each JPEG image and then
+concatenating those hashes in one long string. The other render method,
+`_render_with_graphviz`, still calculates a single hash over all data.
+For DOT-files that generate only one image the end result is the same,
+but because `multi.dot` has two graphs, it produces two images and this
+leads to comparing a string of two hashes with one single hash.
+
+I do not think the change in generating the hash was intentional, for
+the following reasons:
+- Commit 66734d2 states that its purpose was to adapt the test to an
+ API change in pydot. It does not mention a deliberate choice to
+ change the testing method.
+- There was no effort to change `_render_with_graphviz` to also produce
+ multiple hashes.
+- Except for easier debugging in case of a failing test with multiple
+ images (AFAICT, only `multi.dot`), I do not see much added benefit in
+ checking a concatenation of the hashes of all images vs. checking one
+ hash of all images together: In both cases the test will fail if one
+ or more images is rendered differently.
+- Given that there were many commits authored that same hour, including
+ commit 2d55978 which broke the regression tests, I suspect the author
+ did not run the tests for each individual commit, but only at the end
+ of that batch, and was therefore also not alerted of this change by
+ the test suite.
+
+Assuming that the change was not intended, this commit will now revert
+`_render_with_pydot` to the old behavior of calculating a single hash
+from all JPEG image data.
+
+Tested with Debian 9.9, Graphviz 2.38.0-17, Python 2.7.13-2 and 3.5.3-1.
+
+Fixes https://github.com/pydot/pydot/issues/204.
+---
+ test/pydot_unittest.py | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/test/pydot_unittest.py b/test/pydot_unittest.py
+index 881ee16..64aa856 100644
+--- a/test/pydot_unittest.py
++++ b/test/pydot_unittest.py
+@@ -194,11 +194,11 @@ def _render_with_graphviz(self, filename, encoding):
+
+ def _render_with_pydot(self, filename, encoding):
+ c = pydot.graph_from_dot_file(filename, encoding=encoding)
+- sha = ''
++ jpe_data = bytearray()
+ for g in c:
+- jpe_data = g.create(prog=TEST_PROGRAM, format='jpe', encoding=encoding)
+- sha += sha256(jpe_data).hexdigest()
+- return sha
++ jpe_data.extend(g.create(prog=TEST_PROGRAM, format='jpe',
++ encoding=encoding))
++ return sha256(jpe_data).hexdigest()
+
+ def test_my_regression_tests(self):
+ path = os.path.join(test_dir, TESTS_DIR_1)
diff --git a/dev-python/pydot/metadata.xml b/dev-python/pydot/metadata.xml
new file mode 100644
index 000000000000..4d4919a88b2c
--- /dev/null
+++ b/dev-python/pydot/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="pypi">pydot</remote-id>
+ <remote-id type="github">erocarrera/pydot</remote-id>
+ </upstream>
+ <origin>gentoo-staging</origin>
+</pkgmetadata>
diff --git a/dev-python/pydot/pydot-1.4.1.ebuild b/dev-python/pydot/pydot-1.4.1.ebuild
new file mode 100644
index 000000000000..224ae09f8d9f
--- /dev/null
+++ b/dev-python/pydot/pydot-1.4.1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python3_{6..9} )
+
+inherit distutils-r1
+
+DESCRIPTION="Python interface to Graphviz's Dot language"
+HOMEPAGE="https://github.com/erocarrera/pydot https://pypi.org/project/pydot/"
+# pypi releases don't include tests
+SRC_URI="https://github.com/erocarrera/pydot/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="~alpha amd64 arm ~arm64 hppa ~ia64 ~mips ppc ppc64 s390 sparc x86 ~amd64-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+ >=dev-python/pyparsing-2.1.4[${PYTHON_USEDEP}]
+ media-gfx/graphviz"
+BDEPEND="
+ test? (
+ ${RDEPEND}
+ dev-python/chardet[${PYTHON_USEDEP}]
+ )"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-unittest.patch
+)
+
+python_test() {
+ cd test || die
+ "${PYTHON}" pydot_unittest.py || die "Test failed with ${EPYTHON}"
+}