python3Packages.graphviz: 0.17 -> 0.18
This commit is contained in:
parent
75c771c0ed
commit
b534b85ce8
@ -4,6 +4,7 @@
|
|||||||
, fetchFromGitHub
|
, fetchFromGitHub
|
||||||
, substituteAll
|
, substituteAll
|
||||||
, graphviz
|
, graphviz
|
||||||
|
, xdg-utils
|
||||||
, makeFontsConf
|
, makeFontsConf
|
||||||
, freefont_ttf
|
, freefont_ttf
|
||||||
, mock
|
, mock
|
||||||
@ -13,7 +14,7 @@
|
|||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "graphviz";
|
pname = "graphviz";
|
||||||
version = "0.17";
|
version = "0.18";
|
||||||
|
|
||||||
disabled = pythonOlder "3.6";
|
disabled = pythonOlder "3.6";
|
||||||
|
|
||||||
@ -22,13 +23,14 @@ buildPythonPackage rec {
|
|||||||
owner = "xflr6";
|
owner = "xflr6";
|
||||||
repo = "graphviz";
|
repo = "graphviz";
|
||||||
rev = version;
|
rev = version;
|
||||||
sha256 = "sha256-K6z2C7hQH2A9bqgRR4MRqxVAH/k2NQBEelb2/6KDUr0=";
|
sha256 = "sha256-K98CwG+V+EFwzyawVjRwVhbX2FVfoX7dCAD5PXAWTq8=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
(substituteAll {
|
(substituteAll {
|
||||||
src = ./hardcode-graphviz-path.patch;
|
src = ./paths.patch;
|
||||||
inherit graphviz;
|
inherit graphviz;
|
||||||
|
xdgutils = xdg-utils;
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
diff --git a/graphviz/backend.py b/graphviz/backend.py
|
|
||||||
index b66e616..3da4ef0 100644
|
|
||||||
--- a/graphviz/backend.py
|
|
||||||
+++ b/graphviz/backend.py
|
|
||||||
@@ -124,7 +124,7 @@ def command(engine: str, format_: str, filepath=None,
|
|
||||||
raise ValueError(f'unknown formatter: {formatter!r}')
|
|
||||||
|
|
||||||
output_format = [f for f in (format_, renderer, formatter) if f is not None]
|
|
||||||
- cmd = ['dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
|
|
||||||
+ cmd = ['@graphviz@/bin/dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
|
|
||||||
|
|
||||||
if filepath is None:
|
|
||||||
rendered = None
|
|
||||||
@@ -297,7 +297,7 @@ def unflatten(source: str,
|
|
||||||
if fanout and stagger is None:
|
|
||||||
raise RequiredArgumentError('fanout given without stagger')
|
|
||||||
|
|
||||||
- cmd = ['unflatten']
|
|
||||||
+ cmd = ['@graphviz@/bin/unflatten']
|
|
||||||
if stagger is not None:
|
|
||||||
cmd += ['-l', str(stagger)]
|
|
||||||
if fanout:
|
|
||||||
@@ -332,7 +332,7 @@ def version() -> typing.Tuple[int, ...]:
|
|
||||||
Graphviz Release version entry format:
|
|
||||||
https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20
|
|
||||||
"""
|
|
||||||
- cmd = ['dot', '-V']
|
|
||||||
+ cmd = ['@graphviz@/bin/dot', '-V']
|
|
||||||
out, _ = run(cmd, check=True, encoding='ascii',
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT)
|
|
||||||
diff --git a/tests/test_backend.py b/tests/test_backend.py
|
|
||||||
index e0a0e1c..681f178 100644
|
|
||||||
--- a/tests/test_backend.py
|
|
||||||
+++ b/tests/test_backend.py
|
|
||||||
@@ -54,7 +54,7 @@ def test_run_encoding_mocked(mocker, Popen, input='sp\xe4m', encoding='utf-8'):
|
|
||||||
m.decode.assert_called_once_with(encoding)
|
|
||||||
|
|
||||||
|
|
||||||
-@pytest.mark.exe
|
|
||||||
+@pytest.mark.skip(reason='empty $PATH has no effect')
|
|
||||||
@pytest.mark.usefixtures('empty_path')
|
|
||||||
@pytest.mark.parametrize('func, args', [
|
|
||||||
(render, ['dot', 'pdf', 'nonfilepath']),
|
|
||||||
@@ -148,7 +148,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet): # noqa: N803
|
|
||||||
|
|
||||||
assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
|
|
||||||
|
|
||||||
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
|
|
||||||
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
cwd=None, startupinfo=mocker.ANY)
|
|
||||||
@@ -211,7 +211,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, Popen, quiet): # noqa: N803
|
|
||||||
assert e.value.stdout is out
|
|
||||||
e.value.stdout = mocker.sentinel.new_stdout
|
|
||||||
assert e.value.stdout is mocker.sentinel.new_stdout
|
|
||||||
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
|
|
||||||
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
|
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
@@ -231,7 +231,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803
|
|
||||||
|
|
||||||
assert pipe('dot', 'png', b'nongraph', quiet=quiet) == b'stdout'
|
|
||||||
|
|
||||||
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
|
|
||||||
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
|
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
@@ -259,7 +259,7 @@ def test_unflatten_mocked(capsys, mocker, Popen):
|
|
||||||
proc.communicate.return_value = (b'nonresult', b'')
|
|
||||||
|
|
||||||
assert unflatten('nonsource') == 'nonresult'
|
|
||||||
- Popen.assert_called_once_with(['unflatten'],
|
|
||||||
+ Popen.assert_called_once_with(['@graphviz@/bin/unflatten'],
|
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
@@ -290,7 +290,7 @@ def test_version_parsefail_mocked(mocker, Popen): # noqa: N803
|
|
||||||
with pytest.raises(RuntimeError, match=r'nonversioninfo'):
|
|
||||||
version()
|
|
||||||
|
|
||||||
- Popen.assert_called_once_with(['dot', '-V'],
|
|
||||||
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
startupinfo=mocker.ANY)
|
|
||||||
@@ -312,7 +312,7 @@ def test_version_mocked(mocker, Popen, stdout, expected): # noqa: N803
|
|
||||||
|
|
||||||
assert version() == expected
|
|
||||||
|
|
||||||
- Popen.assert_called_once_with(['dot', '-V'],
|
|
||||||
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
startupinfo=mocker.ANY)
|
|
89
pkgs/development/python-modules/graphviz/paths.patch
Normal file
89
pkgs/development/python-modules/graphviz/paths.patch
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
diff --git a/graphviz/backend/dot_command.py b/graphviz/backend/dot_command.py
|
||||||
|
index d1903e6..6470d11 100644
|
||||||
|
--- a/graphviz/backend/dot_command.py
|
||||||
|
+++ b/graphviz/backend/dot_command.py
|
||||||
|
@@ -10,7 +10,7 @@ from . import parameters
|
||||||
|
__all__ = ['command']
|
||||||
|
|
||||||
|
#: :class:`pathlib.Path` of layout command (``Path('dot')``).
|
||||||
|
-DOT_BINARY = pathlib.Path('dot')
|
||||||
|
+DOT_BINARY = pathlib.Path('@graphviz@/bin/dot')
|
||||||
|
|
||||||
|
|
||||||
|
def command(engine: str, format_: str, *,
|
||||||
|
diff --git a/graphviz/backend/unflattening.py b/graphviz/backend/unflattening.py
|
||||||
|
index 5ed25d6..8d2faf8 100644
|
||||||
|
--- a/graphviz/backend/unflattening.py
|
||||||
|
+++ b/graphviz/backend/unflattening.py
|
||||||
|
@@ -11,7 +11,7 @@ from . import execute
|
||||||
|
__all__ = ['unflatten']
|
||||||
|
|
||||||
|
#: :class:`pathlib.Path` of unflatten command (``Path('unflatten')``).
|
||||||
|
-UNFLATTEN_BINARY = pathlib.Path('unflatten')
|
||||||
|
+UNFLATTEN_BINARY = pathlib.Path('@graphviz@/bin/unflatten')
|
||||||
|
|
||||||
|
|
||||||
|
def unflatten(source: str,
|
||||||
|
diff --git a/graphviz/backend/viewing.py b/graphviz/backend/viewing.py
|
||||||
|
index 6d4a4d1..2cc6cd8 100644
|
||||||
|
--- a/graphviz/backend/viewing.py
|
||||||
|
+++ b/graphviz/backend/viewing.py
|
||||||
|
@@ -54,7 +54,7 @@ def view_darwin(filepath, *, quiet: bool) -> None:
|
||||||
|
@tools.attach(view, 'freebsd')
|
||||||
|
def view_unixoid(filepath, *, quiet: bool) -> None:
|
||||||
|
"""Open filepath in the user's preferred application (linux, freebsd)."""
|
||||||
|
- cmd = ['xdg-open', filepath]
|
||||||
|
+ cmd = ['@xdgutils@/bin/xdg-open', filepath]
|
||||||
|
log.debug('view: %r', cmd)
|
||||||
|
kwargs = {'stderr': subprocess.DEVNULL} if quiet else {}
|
||||||
|
subprocess.Popen(cmd, **kwargs)
|
||||||
|
diff --git a/tests/_common.py b/tests/_common.py
|
||||||
|
index ab93461..7eaca89 100644
|
||||||
|
--- a/tests/_common.py
|
||||||
|
+++ b/tests/_common.py
|
||||||
|
@@ -10,7 +10,7 @@ __all__ = ['EXPECTED_DOT_BINARY', 'EXPECTED_DEFAULT_ENCODING',
|
||||||
|
'as_cwd',
|
||||||
|
'check_startupinfo', 'StartupinfoMatcher']
|
||||||
|
|
||||||
|
-EXPECTED_DOT_BINARY = pathlib.Path('dot')
|
||||||
|
+EXPECTED_DOT_BINARY = pathlib.Path('@graphviz@/bin/dot')
|
||||||
|
|
||||||
|
EXPECTED_DEFAULT_ENCODING = 'utf-8'
|
||||||
|
|
||||||
|
diff --git a/tests/backend/test_execute.py b/tests/backend/test_execute.py
|
||||||
|
index 05d6525..78484cb 100644
|
||||||
|
--- a/tests/backend/test_execute.py
|
||||||
|
+++ b/tests/backend/test_execute.py
|
||||||
|
@@ -57,6 +57,7 @@ def test_run_check_input_lines_mocked(mocker, sentinel, mock_popen,
|
||||||
|
mock_sys_stderr.flush.assert_called_once_with()
|
||||||
|
|
||||||
|
|
||||||
|
+@pytest.mark.skip(reason='empty $PATH has no effect')
|
||||||
|
@pytest.mark.usefixtures('empty_path')
|
||||||
|
@pytest.mark.parametrize(
|
||||||
|
'func, args',
|
||||||
|
diff --git a/tests/backend/test_unflattening.py b/tests/backend/test_unflattening.py
|
||||||
|
index 033a4d2..7d52689 100644
|
||||||
|
--- a/tests/backend/test_unflattening.py
|
||||||
|
+++ b/tests/backend/test_unflattening.py
|
||||||
|
@@ -8,7 +8,7 @@ import graphviz
|
||||||
|
|
||||||
|
import _common
|
||||||
|
|
||||||
|
-EXPECTED_UNFLATTEN_BINARY = pathlib.Path('unflatten')
|
||||||
|
+EXPECTED_UNFLATTEN_BINARY = pathlib.Path('@graphviz@/bin/unflatten')
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.exe
|
||||||
|
diff --git a/tests/backend/test_viewing.py b/tests/backend/test_viewing.py
|
||||||
|
index f5acddb..6b34884 100644
|
||||||
|
--- a/tests/backend/test_viewing.py
|
||||||
|
+++ b/tests/backend/test_viewing.py
|
||||||
|
@@ -25,6 +25,6 @@ def test_view(mocker, mock_platform, mock_popen, mock_startfile, quiet):
|
||||||
|
if mock_platform == 'darwin':
|
||||||
|
mock_popen.assert_called_once_with(['open', 'nonfilepath'], **kwargs)
|
||||||
|
elif mock_platform in ('linux', 'freebsd'):
|
||||||
|
- mock_popen.assert_called_once_with(['xdg-open', 'nonfilepath'], **kwargs)
|
||||||
|
+ mock_popen.assert_called_once_with(['@xdgutils@/bin/xdg-open', 'nonfilepath'], **kwargs)
|
||||||
|
else:
|
||||||
|
raise RuntimeError
|
Loading…
Reference in New Issue
Block a user