3
0
Fork 0
forked from mirrors/nixpkgs

Merge pull request #170181 from armeenm/bump-pdfdiff

pdfdiff: 0.92 -> 0.93
This commit is contained in:
Weijia Wang 2023-06-15 01:11:50 +03:00 committed by GitHub
commit d4317fa943
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,37 +1,40 @@
{ lib, python2Packages, fetchurl, xpdf }:
{ lib
, fetchFromGitHub
, python3Packages
, xpdf
}:
python2Packages.buildPythonApplication rec {
python3Packages.buildPythonApplication rec {
pname = "pdfdiff";
version = "0.92";
version = "0.93";
src = fetchurl {
url = "https://www.cs.ox.ac.uk/people/cas.cremers/downloads/software/pdfdiff.py";
sha256 = "0zxwjjbklz87wkbhkmsvhc7xmv5php7m2a9vm6ydhmhlxsybf836";
src = fetchFromGitHub {
owner = "cascremers";
repo = "pdfdiff";
rev = version;
hash = "sha256-NPki/PFm0b71Ksak1mimR4w6J2a0jBCbQDTMQR4uZFI=";
};
buildInputs = [ python2Packages.wrapPython ];
format = "other";
dontConfigure = true;
dontBuild = true;
doCheck = false;
unpackPhase = "cp $src pdfdiff.py";
postPatch = ''
sed -i -r 's|pdftotextProgram = "pdftotext"|pdftotextProgram = "${xpdf}/bin/pdftotext"|' pdfdiff.py
sed -i -r 's|progName = "pdfdiff.py"|progName = "pdfdiff"|' pdfdiff.py
substituteInPlace pdfdiff.py \
--replace 'pdftotextProgram = "pdftotext"' 'pdftotextProgram = "${xpdf}/bin/pdftotext"' \
--replace 'progName = "pdfdiff.py"' 'progName = "pdfdiff"'
'';
installPhase = ''
mkdir -p $out/bin
cp pdfdiff.py $out/bin/pdfdiff
chmod +x $out/bin/pdfdiff
substituteInPlace $out/bin/pdfdiff --replace "#!/usr/bin/python" "#!${python2Packages.python.interpreter}"
'';
meta = with lib; {
homepage = "http://www.cs.ox.ac.uk/people/cas.cremers/misc/pdfdiff.html";
homepage = "https://github.com/cascremers/pdfdiff";
description = "Tool to view the difference between two PDF or PS files";
license = licenses.gpl2Plus;
platforms = platforms.linux;