diff --git a/pkgs/development/python-modules/pydot/default.nix b/pkgs/development/python-modules/pydot/default.nix index ddbc0a5bfdd..694315f2013 100644 --- a/pkgs/development/python-modules/pydot/default.nix +++ b/pkgs/development/python-modules/pydot/default.nix @@ -1,9 +1,11 @@ { lib , buildPythonPackage , fetchPypi +, substituteAll +, graphviz +, python , chardet , pyparsing -, graphviz }: buildPythonPackage rec { @@ -14,10 +16,29 @@ buildPythonPackage rec { inherit pname version; sha256 = "02yp2k7p1kh0azwd932jhvfc3nxxdv9dimh7hdgwdnmp05yms6cq"; }; + + patches = [ + (substituteAll { + src = ./hardcode-graphviz-path.patch; + inherit graphviz; + }) + ]; + + postPatch = '' + # test_graphviz_regression_tests also fails upstream: https://github.com/pydot/pydot/pull/198 + substituteInPlace test/pydot_unittest.py \ + --replace "test_graphviz_regression_tests" "no_test_graphviz_regression_tests" + ''; + + propagatedBuildInputs = [ pyparsing ]; + checkInputs = [ chardet ]; - # No tests in archive - doCheck = false; - propagatedBuildInputs = [pyparsing graphviz]; + + checkPhase = '' + cd test + ${python.interpreter} pydot_unittest.py + ''; + meta = { homepage = https://github.com/erocarrera/pydot; description = "Allows to easily create both directed and non directed graphs from Python"; diff --git a/pkgs/development/python-modules/pydot/hardcode-graphviz-path.patch b/pkgs/development/python-modules/pydot/hardcode-graphviz-path.patch new file mode 100644 index 00000000000..e862f1e7c2c --- /dev/null +++ b/pkgs/development/python-modules/pydot/hardcode-graphviz-path.patch @@ -0,0 +1,13 @@ +diff --git a/pydot.py b/pydot.py +index 3c7da4d..582c5bc 100644 +--- a/pydot.py ++++ b/pydot.py +@@ -124,7 +124,7 @@ def call_graphviz(program, arguments, working_dir, **kwargs): + 'LD_LIBRARY_PATH': os.environ.get('LD_LIBRARY_PATH', ''), + } + +- program_with_args = [program, ] + arguments ++ program_with_args = ['@graphviz@/bin/' + program, ] + arguments + + process = subprocess.Popen( + program_with_args, diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 396970cd835..d0fab989dbc 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -3514,7 +3514,9 @@ in { pydispatcher = callPackage ../development/python-modules/pydispatcher { }; - pydot = callPackage ../development/python-modules/pydot { }; + pydot = callPackage ../development/python-modules/pydot { + inherit (pkgs) graphviz; + }; pydot_ng = callPackage ../development/python-modules/pydot_ng { };