summary refs log tree commit diff
path: root/pkgs/applications/misc/ocropus
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@viric.name>2014-05-29 09:45:12 +0200
committerLluís Batlle i Rossell <viric@viric.name>2014-05-29 09:46:03 +0200
commitcaa9007e847102d013203b547d1ce67bcd77e89a (patch)
tree7074a89ddb7c299e2e85a1e6ab683cecd49f59b3 /pkgs/applications/misc/ocropus
parentd58370db24611bc58cad4fd7ca418075d49431b0 (diff)
downloadnixlib-caa9007e847102d013203b547d1ce67bcd77e89a.tar
nixlib-caa9007e847102d013203b547d1ce67bcd77e89a.tar.gz
nixlib-caa9007e847102d013203b547d1ce67bcd77e89a.tar.bz2
nixlib-caa9007e847102d013203b547d1ce67bcd77e89a.tar.lz
nixlib-caa9007e847102d013203b547d1ce67bcd77e89a.tar.xz
nixlib-caa9007e847102d013203b547d1ce67bcd77e89a.tar.zst
nixlib-caa9007e847102d013203b547d1ce67bcd77e89a.zip
Making ocropus-hocr run (matplotlib + gdk backend)
I added the gtk backend to matplotlib; if these added dependencies are
too much, we can make this optional.
Diffstat (limited to 'pkgs/applications/misc/ocropus')
-rw-r--r--pkgs/applications/misc/ocropus/default.nix5
-rw-r--r--pkgs/applications/misc/ocropus/display.patch17
2 files changed, 22 insertions, 0 deletions
diff --git a/pkgs/applications/misc/ocropus/default.nix b/pkgs/applications/misc/ocropus/default.nix
index aaf0039305b1..66c0b883c726 100644
--- a/pkgs/applications/misc/ocropus/default.nix
+++ b/pkgs/applications/misc/ocropus/default.nix
@@ -44,6 +44,8 @@ pythonPackages.buildPythonPackage rec {
     sha256 = "1s0v0gd6psfjp6lghwl2dj49h18mgf2n2z8hqzw8430nzhglnlvr";
   };
 
+  patches = [ ./display.patch ];
+
   propagatedBuildInputs = with pythonPackages; [ curl numpy scipy pillow
     matplotlib beautifulsoup4 pygtk ];
 
@@ -51,6 +53,9 @@ pythonPackages.buildPythonPackage rec {
   
   preConfigure = with stdenv.lib; ''
     ${concatStrings (map (x: "ln -s ${x.src} models/${x.name};") models)}
+
+    sed -i 's|/usr/local|'$out'|' ocrolib/common.py
+    sed -i 's|/usr/local|'$out'|' ocrolib/default.py
     ${pythonPackages.python}/bin/${pythonPackages.python.executable} setup.py download_models
   '';
 
diff --git a/pkgs/applications/misc/ocropus/display.patch b/pkgs/applications/misc/ocropus/display.patch
new file mode 100644
index 000000000000..2b4e63652b7b
--- /dev/null
+++ b/pkgs/applications/misc/ocropus/display.patch
@@ -0,0 +1,17 @@
+http://code.google.com/p/ocropus/issues/detail?id=365
+
+diff --git a/setup.py b/setup.py
+index c6ade25..a2ad6bf 100644
+--- a/setup.py
++++ b/setup.py
+@@ -8,7 +8,10 @@ assert sys.version_info[0]==2 and sys.version_info[1]>=7,\
+ from distutils.core import setup, Extension, Command
+ from distutils.command.install_data import install_data
+ 
++import matplotlib
++matplotlib.use('Agg')
+ from ocrolib import default
++
+ modeldir = "models/"
+ modelfiles = default.installable
+ modelprefix = "http://iupr1.cs.uni-kl.de/~tmb/ocropus-models/"