about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch')
-rw-r--r--nixpkgs/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch b/nixpkgs/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch
new file mode 100644
index 000000000000..ad632974c28c
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/graphviz/hardcode-graphviz-path.patch
@@ -0,0 +1,95 @@
+diff --git a/graphviz/backend.py b/graphviz/backend.py
+index 704017b..fe4aefe 100644
+--- a/graphviz/backend.py
++++ b/graphviz/backend.py
+@@ -114,7 +114,7 @@ def command(engine, format, filepath=None, renderer=None, formatter=None):
+     suffix = '.'.join(reversed(format_arg))
+     format_arg = ':'.join(format_arg)
+ 
+-    cmd = [engine, '-T%s' % format_arg]
++    cmd = [os.path.join('@graphviz@/bin', engine), '-T%s' % format_arg]
+     rendered = None
+     if filepath is not None:
+         cmd.extend(['-O', filepath])
+@@ -217,7 +217,7 @@ def version():
+         subprocess.CalledProcessError: If the exit status is non-zero.
+         RuntimmeError: If the output cannot be parsed into a version number.
+     """
+-    cmd = ['dot', '-V']
++    cmd = ['@graphviz@/bin/dot', '-V']
+     out, _ = run(cmd, check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ 
+     info = out.decode('ascii')
+diff --git a/tests/test_backend.py b/tests/test_backend.py
+index 7ec12f7..2e8550d 100644
+--- a/tests/test_backend.py
++++ b/tests/test_backend.py
+@@ -47,6 +47,7 @@ def test_render_formatter_unknown():
+         render('dot', 'ps', 'nonfilepath', 'ps', '')
+ 
+ 
++@pytest.mark.skip(reason='empty $PATH has no effect')
+ @pytest.mark.usefixtures('empty_path')
+ def test_render_missing_executable():
+     with pytest.raises(ExecutableNotFound, match=r'execute'):
+@@ -85,7 +86,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet):
+ 
+     assert render('dot', 'pdf', 'nonfilepath', quiet=quiet) == 'nonfilepath.pdf'
+ 
+-    Popen.assert_called_once_with(['dot', '-Tpdf', '-O', 'nonfilepath'],
++    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpdf', '-O', 'nonfilepath'],
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE,
+                                   startupinfo=mocker.ANY)
+@@ -94,6 +95,7 @@ def test_render_mocked(capsys, mocker, Popen, quiet):
+     assert capsys.readouterr() == ('', '' if quiet else 'stderr')
+ 
+ 
++@pytest.mark.skip(reason='empty $PATH has no effect')
+ @pytest.mark.usefixtures('empty_path')
+ def test_pipe_missing_executable():
+     with pytest.raises(ExecutableNotFound, match=r'execute'):
+@@ -143,7 +145,7 @@ def test_pipe_pipe_invalid_data_mocked(mocker, py2, Popen, quiet):  # noqa: N803
+     assert e.value.returncode is mocker.sentinel.returncode
+     assert e.value.stdout is mocker.sentinel.out
+     assert e.value.stderr is err
+-    Popen.assert_called_once_with(['dot', '-Tpng'],
++    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'],
+                                   stdin=subprocess.PIPE,
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE,
+@@ -166,7 +168,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet):  # noqa: N803
+ 
+     assert pipe('dot', 'png', b'nongraph', quiet=quiet) is mocker.sentinel.out
+ 
+-    Popen.assert_called_once_with(['dot', '-Tpng'],
++    Popen.assert_called_once_with(['@graphviz@/bin/dot', '-Tpng'],
+                                   stdin=subprocess.PIPE,
+                                   stdout=subprocess.PIPE,
+                                   stderr=subprocess.PIPE,
+@@ -176,6 +178,7 @@ def test_pipe_mocked(capsys, mocker, Popen, quiet):  # noqa: N803
+     assert capsys.readouterr() == ('', '' if quiet else 'stderr')
+ 
+ 
++@pytest.mark.skip(reason='empty $PATH has no effect')
+ @pytest.mark.usefixtures('empty_path')
+ def test_version_missing_executable():
+     with pytest.raises(ExecutableNotFound, match=r'execute'):
+@@ -196,7 +199,7 @@ def test_version_parsefail_mocked(mocker, Popen):
+     with pytest.raises(RuntimeError):
+         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)
+@@ -211,7 +214,7 @@ def test_version_mocked(mocker, Popen):
+ 
+     assert version() == (1, 2, 3)
+ 
+-    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)