diff options
author | Will Dietz <w@wdtz.org> | 2020-01-21 18:14:49 -0600 |
---|---|---|
committer | Will Dietz <w@wdtz.org> | 2020-01-21 18:14:49 -0600 |
commit | 6b1937818e7f18ee7eac034cb9ccc84db0087dfc (patch) | |
tree | 10275560812519ab746d805f24eaa8463149f5f7 /pkgs/tools | |
parent | 24c14a8fc90917cf0e2575166ac25b3cf4de3e15 (diff) | |
download | nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.tar nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.tar.gz nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.tar.bz2 nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.tar.lz nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.tar.xz nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.tar.zst nixpkgs-6b1937818e7f18ee7eac034cb9ccc84db0087dfc.zip |
ocrmypdf: prefer patch + substituteAll
Diffstat (limited to 'pkgs/tools')
-rw-r--r-- | pkgs/tools/text/ocrmypdf/default.nix | 12 | ||||
-rw-r--r-- | pkgs/tools/text/ocrmypdf/liblept.patch | 13 |
2 files changed, 20 insertions, 5 deletions
diff --git a/pkgs/tools/text/ocrmypdf/default.nix b/pkgs/tools/text/ocrmypdf/default.nix index a301e9310d9..020bba189de 100644 --- a/pkgs/tools/text/ocrmypdf/default.nix +++ b/pkgs/tools/text/ocrmypdf/default.nix @@ -10,6 +10,7 @@ , stdenv , tesseract4 , unpaper +, substituteAll }: let @@ -68,11 +69,12 @@ in buildPythonApplication rec { setuptools ] ++ runtimeDeps; - postPatch = '' - substituteInPlace src/ocrmypdf/leptonica.py \ - --replace '_libpath = find_library(libname)' \ - '_libpath = "${stdenv.lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}"' - ''; + patches = [ + (substituteAll { + src = ./liblept.patch; + liblept = "${stdenv.lib.getLib leptonica}/lib/liblept${stdenv.hostPlatform.extensions.sharedLibrary}"; + }) + ]; # The tests take potentially 20+ minutes, depending on machine doCheck = false; diff --git a/pkgs/tools/text/ocrmypdf/liblept.patch b/pkgs/tools/text/ocrmypdf/liblept.patch new file mode 100644 index 00000000000..ed413a8b37b --- /dev/null +++ b/pkgs/tools/text/ocrmypdf/liblept.patch @@ -0,0 +1,13 @@ +diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py +index 328b063..b993cc9 100644 +--- a/src/ocrmypdf/leptonica.py ++++ b/src/ocrmypdf/leptonica.py +@@ -46,7 +46,7 @@ if os.name == 'nt': + os.environ['PATH'] = shim_paths_with_program_files() + else: + libname = 'lept' +-_libpath = find_library(libname) ++_libpath = '@liblept@' + if not _libpath: + raise MissingDependencyError( + """ |