1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pygments,
6 gitMinimal,
7 mercurial,
8 subversion,
9 p4,
10 less,
11}:
12
13buildPythonPackage rec {
14 pname = "ydiff";
15 version = "1.4.2";
16 format = "setuptools";
17
18 src = fetchFromGitHub {
19 owner = "ymattw";
20 repo = "ydiff";
21 tag = version;
22 hash = "sha256-JaGkABroj+/7MrgpFYI2vE1bndsilIodopMUnfmNhwA=";
23 };
24
25 patchPhase = ''
26 substituteInPlace ydiff.py \
27 --replace-fail "['git'" "['${lib.getExe gitMinimal}'" \
28 --replace-fail "['hg'" "['${lib.getExe mercurial}'" \
29 --replace-fail "['svn'" "['${lib.getExe subversion}'" \
30 --replace-fail "['p4'" "['${lib.getExe p4}'" \
31 --replace-fail "['less'" "['${lib.getExe less}'" # doesn't support PAGER from env
32 substituteInPlace tests/test_ydiff.py \
33 --replace-fail /bin/rm rm \
34 --replace-fail /bin/sh sh
35 patchShebangs setup.py
36 patchShebangs tests/*.sh
37 '';
38
39 nativeCheckInputs = [ pygments ];
40
41 checkPhase = ''
42 runHook preCheck
43 make reg # We don't want the linter or coverage check.
44 runHook postCheck
45 '';
46
47 meta = with lib; {
48 description = "View colored, incremental diff in workspace or from stdin with side by side and auto pager support (Was \"cdiff\")";
49 mainProgram = "ydiff";
50 longDescription = ''
51 Term based tool to view colored, incremental diff in a version
52 controlled workspace (supports Git, Mercurial, Perforce and Svn
53 so far) or from stdin, with side by side (similar to diff -y)
54 and auto pager support.
55 '';
56 homepage = "https://github.com/ymattw/ydiff";
57 license = licenses.bsd3;
58 maintainers = with maintainers; [ leenaars ];
59 teams = [ teams.deshaw ];
60 };
61}