depot/third_party/nixpkgs/pkgs/development/python-modules/graphviz/paths.patch
Default email ce641f4048 Project import generated by Copybara.
GitOrigin-RevId: bc5d68306b40b8522ffb69ba6cff91898c2fbbff
2021-12-06 17:07:01 +01:00

79 lines
3.2 KiB
Diff

diff --git a/graphviz/backend/dot_command.py b/graphviz/backend/dot_command.py
index 1e123d1..41e19c2 100644
--- a/graphviz/backend/dot_command.py
+++ b/graphviz/backend/dot_command.py
@@ -11,7 +11,7 @@ from . import _common
__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 87b4cbd..4188beb 100644
--- a/tests/_common.py
+++ b/tests/_common.py
@@ -14,9 +14,9 @@ __all__ = ['EXPECTED_DOT_BINARY', 'EXPECTED_UNFLATTEN_BINARY',
'as_cwd',
'check_startupinfo', 'StartupinfoMatcher']
-EXPECTED_DOT_BINARY = _compat.make_subprocess_arg(pathlib.Path('dot'))
+EXPECTED_DOT_BINARY = _compat.make_subprocess_arg(pathlib.Path('@graphviz@/bin/dot'))
-EXPECTED_UNFLATTEN_BINARY = _compat.make_subprocess_arg(pathlib.Path('unflatten'))
+EXPECTED_UNFLATTEN_BINARY = _compat.make_subprocess_arg(pathlib.Path('@graphviz@/bin/unflatten'))
EXPECTED_DEFAULT_ENCODING = 'utf-8'
diff --git a/tests/backend/test_execute.py b/tests/backend/test_execute.py
index 2cb853a..8093dfe 100644
--- a/tests/backend/test_execute.py
+++ b/tests/backend/test_execute.py
@@ -15,6 +15,7 @@ def empty_path(monkeypatch):
monkeypatch.setenv('PATH', '')
+@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_viewing.py b/tests/backend/test_viewing.py
index 59a23d5..f73f905 100644
--- a/tests/backend/test_viewing.py
+++ b/tests/backend/test_viewing.py
@@ -26,6 +26,6 @@ def test_view_mocked(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