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