summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/icdiff/default.nix
blob: 89587e1f8749f1a8209dde9a61f372844c758962 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{
  lib,
  stdenv,
  python,
  buildPythonPackage,
  fetchFromGitHub,
  setuptools,
  pytestCheckHook,
  pythonAtLeast,
  writableTmpDirAsHomeHook,
  pkgs,
}:
let
  inherit (pkgs) bash git less;
in

buildPythonPackage rec {
  pname = "icdiff";
  version = "2.0.9";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "jeffkaufman";
    repo = "icdiff";
    tag = "release-${version}";
    hash = "sha256-ykQLF2b47RZSlrJXYpZ03evhpcGfVyTYwpO2UbmWqrY=";
    deepClone = true;
  };

  patches = [ ./0001-Don-t-test-black-or-flake8.patch ];

  build-system = [ setuptools ];

  pythonImportsCheck = [ "icdiff" ];

  nativeCheckInputs = [
    bash
    git
    less
    writableTmpDirAsHomeHook
  ];

  # Before the wheel gets created, fix up the shebangs.
  preBuild = ''
    patchShebangs test.sh icdiff git-icdiff
  '';

  # Odd behavior in the sandbox
  doCheck = !stdenv.hostPlatform.isDarwin;

  checkPhase = ''
    runHook preCheck

    ./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 ];
  };
}