tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
0
fork
atom
lol
0
fork
atom
overview
issues
pulls
pipelines
python3Packages.graphviz: 0.17 -> 0.18
Robert Schütz
4 years ago
b534b85c
75c771c0
+94
-101
3 changed files
expand all
collapse all
unified
split
pkgs
development
python-modules
graphviz
default.nix
hardcode-graphviz-path.patch
paths.patch
+5
-3
pkgs/development/python-modules/graphviz/default.nix
···
4
4
, fetchFromGitHub
5
5
, substituteAll
6
6
, graphviz
7
7
+
, xdg-utils
7
8
, makeFontsConf
8
9
, freefont_ttf
9
10
, mock
···
13
14
14
15
buildPythonPackage rec {
15
16
pname = "graphviz";
16
16
-
version = "0.17";
17
17
+
version = "0.18";
17
18
18
19
disabled = pythonOlder "3.6";
19
20
···
22
23
owner = "xflr6";
23
24
repo = "graphviz";
24
25
rev = version;
25
25
-
sha256 = "sha256-K6z2C7hQH2A9bqgRR4MRqxVAH/k2NQBEelb2/6KDUr0=";
26
26
+
sha256 = "sha256-K98CwG+V+EFwzyawVjRwVhbX2FVfoX7dCAD5PXAWTq8=";
26
27
};
27
28
28
29
patches = [
29
30
(substituteAll {
30
30
-
src = ./hardcode-graphviz-path.patch;
31
31
+
src = ./paths.patch;
31
32
inherit graphviz;
33
33
+
xdgutils = xdg-utils;
32
34
})
33
35
];
34
36
-98
pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch
···
1
1
-
diff --git a/graphviz/backend.py b/graphviz/backend.py
2
2
-
index b66e616..3da4ef0 100644
3
3
-
--- a/graphviz/backend.py
4
4
-
+++ b/graphviz/backend.py
5
5
-
@@ -124,7 +124,7 @@ def command(engine: str, format_: str, filepath=None,
6
6
-
raise ValueError(f'unknown formatter: {formatter!r}')
7
7
-
8
8
-
output_format = [f for f in (format_, renderer, formatter) if f is not None]
9
9
-
- cmd = ['dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
10
10
-
+ cmd = ['@graphviz@/bin/dot', '-K%s' % engine, '-T%s' % ':'.join(output_format)]
11
11
-
12
12
-
if filepath is None:
13
13
-
rendered = None
14
14
-
@@ -297,7 +297,7 @@ def unflatten(source: str,
15
15
-
if fanout and stagger is None:
16
16
-
raise RequiredArgumentError('fanout given without stagger')
17
17
-
18
18
-
- cmd = ['unflatten']
19
19
-
+ cmd = ['@graphviz@/bin/unflatten']
20
20
-
if stagger is not None:
21
21
-
cmd += ['-l', str(stagger)]
22
22
-
if fanout:
23
23
-
@@ -332,7 +332,7 @@ def version() -> typing.Tuple[int, ...]:
24
24
-
Graphviz Release version entry format:
25
25
-
https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20
26
26
-
"""
27
27
-
- cmd = ['dot', '-V']
28
28
-
+ cmd = ['@graphviz@/bin/dot', '-V']
29
29
-
out, _ = run(cmd, check=True, encoding='ascii',
30
30
-
stdout=subprocess.PIPE,
31
31
-
stderr=subprocess.STDOUT)
32
32
-
diff --git a/tests/test_backend.py b/tests/test_backend.py
33
33
-
index e0a0e1c..681f178 100644
34
34
-
--- a/tests/test_backend.py
35
35
-
+++ b/tests/test_backend.py
36
36
-
@@ -54,7 +54,7 @@ def test_run_encoding_mocked(mocker, Popen, input='sp\xe4m', encoding='utf-8'):
37
37
-
m.decode.assert_called_once_with(encoding)
38
38
-
39
39
-
40
40
-
-@pytest.mark.exe
41
41
-
+@pytest.mark.skip(reason='empty $PATH has no effect')
42
42
-
@pytest.mark.usefixtures('empty_path')
43
43
-
@pytest.mark.parametrize('func, args', [
44
44
-
(render, ['dot', 'pdf', 'nonfilepath']),
45
45
-
@@ -148,7 +148,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet): # noqa: N803
46
46
-
47
47
-
assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
48
48
-
49
49
-
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
50
50
-
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpdf', '-O', 'nonfilepath'],
51
51
-
stdout=subprocess.PIPE,
52
52
-
stderr=subprocess.PIPE,
53
53
-
cwd=None, startupinfo=mocker.ANY)
54
54
-
@@ -211,7 +211,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, Popen, quiet): # noqa: N803
55
55
-
assert e.value.stdout is out
56
56
-
e.value.stdout = mocker.sentinel.new_stdout
57
57
-
assert e.value.stdout is mocker.sentinel.new_stdout
58
58
-
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
59
59
-
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
60
60
-
stdin=subprocess.PIPE,
61
61
-
stdout=subprocess.PIPE,
62
62
-
stderr=subprocess.PIPE,
63
63
-
@@ -231,7 +231,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet): # noqa: N803
64
64
-
65
65
-
assert pipe('dot', 'png', b'nongraph', quiet=quiet) == b'stdout'
66
66
-
67
67
-
- Popen.assert_called_once_with(['dot', '-Kdot', '-Tpng'],
68
68
-
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Kdot', '-Tpng'],
69
69
-
stdin=subprocess.PIPE,
70
70
-
stdout=subprocess.PIPE,
71
71
-
stderr=subprocess.PIPE,
72
72
-
@@ -259,7 +259,7 @@ def test_unflatten_mocked(capsys, mocker, Popen):
73
73
-
proc.communicate.return_value = (b'nonresult', b'')
74
74
-
75
75
-
assert unflatten('nonsource') == 'nonresult'
76
76
-
- Popen.assert_called_once_with(['unflatten'],
77
77
-
+ Popen.assert_called_once_with(['@graphviz@/bin/unflatten'],
78
78
-
stdin=subprocess.PIPE,
79
79
-
stdout=subprocess.PIPE,
80
80
-
stderr=subprocess.PIPE,
81
81
-
@@ -290,7 +290,7 @@ def test_version_parsefail_mocked(mocker, Popen): # noqa: N803
82
82
-
with pytest.raises(RuntimeError, match=r'nonversioninfo'):
83
83
-
version()
84
84
-
85
85
-
- Popen.assert_called_once_with(['dot', '-V'],
86
86
-
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
87
87
-
stdout=subprocess.PIPE,
88
88
-
stderr=subprocess.STDOUT,
89
89
-
startupinfo=mocker.ANY)
90
90
-
@@ -312,7 +312,7 @@ def test_version_mocked(mocker, Popen, stdout, expected): # noqa: N803
91
91
-
92
92
-
assert version() == expected
93
93
-
94
94
-
- Popen.assert_called_once_with(['dot', '-V'],
95
95
-
+ Popen.assert_called_once_with(['@graphviz@/bin/dot', '-V'],
96
96
-
stdout=subprocess.PIPE,
97
97
-
stderr=subprocess.STDOUT,
98
98
-
startupinfo=mocker.ANY)
+89
pkgs/development/python-modules/graphviz/paths.patch
···
1
1
+
diff --git a/graphviz/backend/dot_command.py b/graphviz/backend/dot_command.py
2
2
+
index d1903e6..6470d11 100644
3
3
+
--- a/graphviz/backend/dot_command.py
4
4
+
+++ b/graphviz/backend/dot_command.py
5
5
+
@@ -10,7 +10,7 @@ from . import parameters
6
6
+
__all__ = ['command']
7
7
+
8
8
+
#: :class:`pathlib.Path` of layout command (``Path('dot')``).
9
9
+
-DOT_BINARY = pathlib.Path('dot')
10
10
+
+DOT_BINARY = pathlib.Path('@graphviz@/bin/dot')
11
11
+
12
12
+
13
13
+
def command(engine: str, format_: str, *,
14
14
+
diff --git a/graphviz/backend/unflattening.py b/graphviz/backend/unflattening.py
15
15
+
index 5ed25d6..8d2faf8 100644
16
16
+
--- a/graphviz/backend/unflattening.py
17
17
+
+++ b/graphviz/backend/unflattening.py
18
18
+
@@ -11,7 +11,7 @@ from . import execute
19
19
+
__all__ = ['unflatten']
20
20
+
21
21
+
#: :class:`pathlib.Path` of unflatten command (``Path('unflatten')``).
22
22
+
-UNFLATTEN_BINARY = pathlib.Path('unflatten')
23
23
+
+UNFLATTEN_BINARY = pathlib.Path('@graphviz@/bin/unflatten')
24
24
+
25
25
+
26
26
+
def unflatten(source: str,
27
27
+
diff --git a/graphviz/backend/viewing.py b/graphviz/backend/viewing.py
28
28
+
index 6d4a4d1..2cc6cd8 100644
29
29
+
--- a/graphviz/backend/viewing.py
30
30
+
+++ b/graphviz/backend/viewing.py
31
31
+
@@ -54,7 +54,7 @@ def view_darwin(filepath, *, quiet: bool) -> None:
32
32
+
@tools.attach(view, 'freebsd')
33
33
+
def view_unixoid(filepath, *, quiet: bool) -> None:
34
34
+
"""Open filepath in the user's preferred application (linux, freebsd)."""
35
35
+
- cmd = ['xdg-open', filepath]
36
36
+
+ cmd = ['@xdgutils@/bin/xdg-open', filepath]
37
37
+
log.debug('view: %r', cmd)
38
38
+
kwargs = {'stderr': subprocess.DEVNULL} if quiet else {}
39
39
+
subprocess.Popen(cmd, **kwargs)
40
40
+
diff --git a/tests/_common.py b/tests/_common.py
41
41
+
index ab93461..7eaca89 100644
42
42
+
--- a/tests/_common.py
43
43
+
+++ b/tests/_common.py
44
44
+
@@ -10,7 +10,7 @@ __all__ = ['EXPECTED_DOT_BINARY', 'EXPECTED_DEFAULT_ENCODING',
45
45
+
'as_cwd',
46
46
+
'check_startupinfo', 'StartupinfoMatcher']
47
47
+
48
48
+
-EXPECTED_DOT_BINARY = pathlib.Path('dot')
49
49
+
+EXPECTED_DOT_BINARY = pathlib.Path('@graphviz@/bin/dot')
50
50
+
51
51
+
EXPECTED_DEFAULT_ENCODING = 'utf-8'
52
52
+
53
53
+
diff --git a/tests/backend/test_execute.py b/tests/backend/test_execute.py
54
54
+
index 05d6525..78484cb 100644
55
55
+
--- a/tests/backend/test_execute.py
56
56
+
+++ b/tests/backend/test_execute.py
57
57
+
@@ -57,6 +57,7 @@ def test_run_check_input_lines_mocked(mocker, sentinel, mock_popen,
58
58
+
mock_sys_stderr.flush.assert_called_once_with()
59
59
+
60
60
+
61
61
+
+@pytest.mark.skip(reason='empty $PATH has no effect')
62
62
+
@pytest.mark.usefixtures('empty_path')
63
63
+
@pytest.mark.parametrize(
64
64
+
'func, args',
65
65
+
diff --git a/tests/backend/test_unflattening.py b/tests/backend/test_unflattening.py
66
66
+
index 033a4d2..7d52689 100644
67
67
+
--- a/tests/backend/test_unflattening.py
68
68
+
+++ b/tests/backend/test_unflattening.py
69
69
+
@@ -8,7 +8,7 @@ import graphviz
70
70
+
71
71
+
import _common
72
72
+
73
73
+
-EXPECTED_UNFLATTEN_BINARY = pathlib.Path('unflatten')
74
74
+
+EXPECTED_UNFLATTEN_BINARY = pathlib.Path('@graphviz@/bin/unflatten')
75
75
+
76
76
+
77
77
+
@pytest.mark.exe
78
78
+
diff --git a/tests/backend/test_viewing.py b/tests/backend/test_viewing.py
79
79
+
index f5acddb..6b34884 100644
80
80
+
--- a/tests/backend/test_viewing.py
81
81
+
+++ b/tests/backend/test_viewing.py
82
82
+
@@ -25,6 +25,6 @@ def test_view(mocker, mock_platform, mock_popen, mock_startfile, quiet):
83
83
+
if mock_platform == 'darwin':
84
84
+
mock_popen.assert_called_once_with(['open', 'nonfilepath'], **kwargs)
85
85
+
elif mock_platform in ('linux', 'freebsd'):
86
86
+
- mock_popen.assert_called_once_with(['xdg-open', 'nonfilepath'], **kwargs)
87
87
+
+ mock_popen.assert_called_once_with(['@xdgutils@/bin/xdg-open', 'nonfilepath'], **kwargs)
88
88
+
else:
89
89
+
raise RuntimeError