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.
This commit is contained in:
Lluís Batlle i Rossell 2014-05-29 09:45:12 +02:00
parent d58370db24
commit caa9007e84
3 changed files with 24 additions and 1 deletions

View file

@ -44,6 +44,8 @@ pythonPackages.buildPythonPackage rec {
sha256 = "1s0v0gd6psfjp6lghwl2dj49h18mgf2n2z8hqzw8430nzhglnlvr"; sha256 = "1s0v0gd6psfjp6lghwl2dj49h18mgf2n2z8hqzw8430nzhglnlvr";
}; };
patches = [ ./display.patch ];
propagatedBuildInputs = with pythonPackages; [ curl numpy scipy pillow propagatedBuildInputs = with pythonPackages; [ curl numpy scipy pillow
matplotlib beautifulsoup4 pygtk ]; matplotlib beautifulsoup4 pygtk ];
@ -51,6 +53,9 @@ pythonPackages.buildPythonPackage rec {
preConfigure = with stdenv.lib; '' preConfigure = with stdenv.lib; ''
${concatStrings (map (x: "ln -s ${x.src} models/${x.name};") models)} ${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 ${pythonPackages.python}/bin/${pythonPackages.python.executable} setup.py download_models
''; '';

View file

@ -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/"

View file

@ -3963,7 +3963,8 @@ rec {
(if stdenv.isDarwin then [ pkgs.clangStdenv ] else [ pkgs.stdenv ]); (if stdenv.isDarwin then [ pkgs.clangStdenv ] else [ pkgs.stdenv ]);
propagatedBuildInputs = propagatedBuildInputs =
[ dateutil nose numpy pyparsing tornado pkgs.freetype pkgs.libpng pkgs.pkgconfig ]; [ dateutil nose numpy pyparsing tornado pkgs.freetype pkgs.libpng pkgs.pkgconfig
pygtk ];
meta = with stdenv.lib; { meta = with stdenv.lib; {
description = "python plotting library, making publication quality plots"; description = "python plotting library, making publication quality plots";