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