diff --git a/pkgs/by-name/ic/icdiff/package.nix b/pkgs/by-name/ic/icdiff/package.nix index d34b976f068e..98144d145cd0 100644 --- a/pkgs/by-name/ic/icdiff/package.nix +++ b/pkgs/by-name/ic/icdiff/package.nix @@ -1,41 +1,3 @@ -{ - lib, - python3Packages, - fetchFromGitHub, - bash, - git, - less, -}: +{ python3Packages }: -python3Packages.buildPythonApplication rec { - pname = "icdiff"; - version = "2.0.7"; - - src = fetchFromGitHub { - owner = "jeffkaufman"; - repo = "icdiff"; - tag = "release-${version}"; - hash = "sha256-XOw/xhPGlzi1hAgzQ1EtioUM476A+lQWLlvvaxd9j08="; - }; - - # error: could not lock config file /homeless-shelter/.gitconfig: No such file or directory - doCheck = false; - - nativeCheckInputs = [ - bash - git - less - ]; - - checkPhase = '' - patchShebangs test.sh - ./test.sh ${python3Packages.python.interpreter} - ''; - - meta = { - homepage = "https://www.jefftk.com/icdiff"; - description = "Side-by-side highlighted command line diffs"; - maintainers = [ ]; - license = lib.licenses.psfl; - }; -} +python3Packages.toPythonApplication python3Packages.icdiff diff --git a/pkgs/development/python-modules/icdiff/0001-Don-t-test-black-or-flake8.patch b/pkgs/development/python-modules/icdiff/0001-Don-t-test-black-or-flake8.patch new file mode 100644 index 000000000000..3e8a067c7841 --- /dev/null +++ b/pkgs/development/python-modules/icdiff/0001-Don-t-test-black-or-flake8.patch @@ -0,0 +1,35 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Philip Taron +Date: Thu, 29 May 2025 14:47:58 -0700 +Subject: [PATCH] Don't test black or flake8 + +Signed-off-by: Philip Taron +--- + test.sh | 14 -------------- + 1 file changed, 14 deletions(-) + +diff --git a/test.sh b/test.sh +index 1dd6c4be579e8a61d2d284b042c54cd2a1e0ff77..dc9ecab4a9097878a0a65c45df38a4fa25eb9fa2 100755 +--- a/test.sh ++++ b/test.sh +@@ -210,20 +210,6 @@ function ensure_installed() { + fi + } + +-ensure_installed "black" +-echo 'Running black formatter...' +-if ! black icdiff --quiet --line-length 79 --check; then +- echo "" +- echo 'Consider running `black icdiff --line-length 79`' +- fail +-fi +- +-ensure_installed "flake8" +-echo 'Running flake8 linter...' +-if ! flake8 icdiff; then +- fail +-fi +- + if ! $REGOLD; then + echo PASS + fi diff --git a/pkgs/development/python-modules/icdiff/default.nix b/pkgs/development/python-modules/icdiff/default.nix new file mode 100644 index 000000000000..b1bd7addd69b --- /dev/null +++ b/pkgs/development/python-modules/icdiff/default.nix @@ -0,0 +1,61 @@ +{ + lib, + stdenv, + python, + buildPythonPackage, + fetchFromGitHub, + setuptools, + pytestCheckHook, + writableTmpDirAsHomeHook, + pkgs, +}: +let + inherit (pkgs) bash git less; +in + +buildPythonPackage rec { + pname = "icdiff"; + version = "2.0.7"; + pyproject = true; + + src = fetchFromGitHub { + owner = "jeffkaufman"; + repo = "icdiff"; + tag = "release-${version}"; + hash = "sha256-XOw/xhPGlzi1hAgzQ1EtioUM476A+lQWLlvvaxd9j08="; + leaveDotGit = true; + }; + + patches = [ ./0001-Don-t-test-black-or-flake8.patch ]; + + build-system = [ setuptools ]; + + pythonImportsCheck = [ "icdiff" ]; + + nativeCheckInputs = [ + bash + git + less + writableTmpDirAsHomeHook + ]; + + # Odd behavior in the sandbox + doCheck = !stdenv.hostPlatform.isDarwin; + + checkPhase = '' + runHook preCheck + + patchShebangs test.sh + ./test.sh ${python.interpreter} + + runHook postCheck + ''; + + meta = { + description = "Improved colorized diff"; + homepage = "https://github.com/jeffkaufman/icdiff"; + changelog = "https://github.com/jeffkaufman/icdiff/releases/tag/release-${version}/CHANGELOG.md"; + license = lib.licenses.psfl; + maintainers = with lib.maintainers; [ philiptaron ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index dfdcd352fe26..9ac94ee07768 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -6650,6 +6650,8 @@ self: super: with self; { icalevents = callPackage ../development/python-modules/icalevents { }; + icdiff = callPackage ../development/python-modules/icdiff { }; + icecream = callPackage ../development/python-modules/icecream { }; iceportal = callPackage ../development/python-modules/iceportal { };