summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ydiff/default.nix
blob: 3e5fc98c261427616b9d79c657f8be6d5d444361 (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
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pygments,
  gitMinimal,
  mercurial,
  subversion,
  p4,
  less,
}:

buildPythonPackage rec {
  pname = "ydiff";
  version = "1.5";
  format = "setuptools";

  src = fetchFromGitHub {
    owner = "ymattw";
    repo = "ydiff";
    tag = version;
    hash = "sha256-9a7M6+CqGRvO1yainImN2RQVH3XMxE9PTLXJGKekXLg=";
  };

  patchPhase = ''
    substituteInPlace ydiff.py \
      --replace-fail "['git'" "['${lib.getExe gitMinimal}'" \
      --replace-fail "['hg'" "['${lib.getExe mercurial}'" \
      --replace-fail "['svn'" "['${lib.getExe subversion}'" \
      --replace-fail "['p4'" "['${lib.getExe p4}'" \
      --replace-fail "['less'" "['${lib.getExe less}'" # doesn't support PAGER from env
    substituteInPlace tests/test_ydiff.py \
      --replace-fail /bin/rm rm \
      --replace-fail /bin/sh sh
    patchShebangs setup.py
    patchShebangs tests/*.sh
  '';

  nativeCheckInputs = [ pygments ];

  checkPhase = ''
    runHook preCheck
    make reg # We don't want the linter or coverage check.
    runHook postCheck
  '';

  meta = {
    description = "View colored, incremental diff in workspace or from stdin with side by side and auto pager support (Was \"cdiff\")";
    mainProgram = "ydiff";
    longDescription = ''
      Term based tool to view colored, incremental diff in a version
      controlled workspace (supports Git, Mercurial, Perforce and Svn
      so far) or from stdin, with side by side (similar to diff -y)
      and auto pager support.
    '';
    homepage = "https://github.com/ymattw/ydiff";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [
      de11n
      despsyched
    ];
  };
}