From 4c8b3fe3baf55a84f46efdfd5920434b9c57ee39 Mon Sep 17 00:00:00 2001 From: Theodore Ni <3806110+tjni@users.noreply.github.com> Date: Fri, 11 Aug 2023 22:12:35 -0700 Subject: [PATCH] python3.pkgs.dot2tex: fix duplicate script breaking installation --- .../python-modules/dot2tex/default.nix | 19 ++++++----- .../dot2tex/remove-duplicate-script.patch | 34 +++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) create mode 100644 pkgs/development/python-modules/dot2tex/remove-duplicate-script.patch diff --git a/pkgs/development/python-modules/dot2tex/default.nix b/pkgs/development/python-modules/dot2tex/default.nix index 955d57ffd5c6..15e0c655f80f 100644 --- a/pkgs/development/python-modules/dot2tex/default.nix +++ b/pkgs/development/python-modules/dot2tex/default.nix @@ -1,20 +1,22 @@ { lib -, python , buildPythonPackage +, fetchpatch , fetchPypi , substituteAll , pyparsing , graphviz +, pytestCheckHook , texlive }: buildPythonPackage rec { pname = "dot2tex"; version = "2.11.3"; + format = "setuptools"; src = fetchPypi { inherit pname version; - sha256 = "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"; + hash = "sha256-KZoq8FruW74CV6VipQapPieSk9XDjyjQirissyM/584="; }; patches = [ @@ -23,24 +25,25 @@ buildPythonPackage rec { inherit graphviz; }) ./test.patch # https://github.com/kjellmf/dot2tex/issues/5 + + # https://github.com/xyz2tex/dot2tex/pull/104 does not merge cleanly + ./remove-duplicate-script.patch ]; - propagatedBuildInputs = [ pyparsing ]; + propagatedBuildInputs = [ + pyparsing + ]; nativeCheckInputs = [ + pytestCheckHook (texlive.combine { inherit (texlive) scheme-small preview pstricks; }) ]; - checkPhase = '' - ${python.interpreter} tests/test_dot2tex.py - ''; - meta = with lib; { description = "Convert graphs generated by Graphviz to LaTeX friendly formats"; homepage = "https://github.com/kjellmf/dot2tex"; license = licenses.mit; }; - } diff --git a/pkgs/development/python-modules/dot2tex/remove-duplicate-script.patch b/pkgs/development/python-modules/dot2tex/remove-duplicate-script.patch new file mode 100644 index 000000000000..c67ad62224b7 --- /dev/null +++ b/pkgs/development/python-modules/dot2tex/remove-duplicate-script.patch @@ -0,0 +1,34 @@ +From 98a0fbd0c4e13df98b8fb69c241665ab774fda2e Mon Sep 17 00:00:00 2001 +From: Theodore Ni <3806110+tjni@users.noreply.github.com> +Date: Fri, 11 Aug 2023 21:58:14 -0700 +Subject: [PATCH] Remove script with same name as entry point + +--- + dot2tex/dot2tex | 5 ----- + setup.py | 1 - + 2 files changed, 6 deletions(-) + delete mode 100644 dot2tex/dot2tex + +diff --git a/dot2tex/dot2tex b/dot2tex/dot2tex +deleted file mode 100644 +index 278c0b3..0000000 +--- a/dot2tex/dot2tex ++++ /dev/null +@@ -1,5 +0,0 @@ +-#!/usr/bin/env python +-from .dot2tex import main +- +-if __name__ == '__main__': +- main() +diff --git a/setup.py b/setup.py +index d05db37..67a3ee8 100644 +--- a/setup.py ++++ b/setup.py +@@ -21,7 +21,6 @@ + author_email='kjellmf@gmail.com', + url="https://github.com/kjellmf/dot2tex", + py_modules=['dot2tex.dot2tex', 'dot2tex.dotparsing'], +- scripts=['dot2tex/dot2tex'], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Console', \ No newline at end of file