1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-21 05:00:16 +00:00

ocropus: 20130905 -> 20150316

This commit is contained in:
Tobias Geerinckx-Rice 2015-04-16 03:34:35 +02:00
parent 54d262f4ab
commit a3aa361e91
2 changed files with 23 additions and 51 deletions

View file

@ -1,9 +1,9 @@
{ stdenv, fetchhg, fetchurl, pythonPackages, curl }:
{ stdenv, fetchFromGitHub, fetchurl, pythonPackages, curl }:
let
getmodel = name: sha256: {
src = fetchurl {
url = "http://iupr1.cs.uni-kl.de/~tmb/ocropus-models/${name}";
url = "http://www.tmbdev.net/ocropy/${name}";
inherit sha256;
};
inherit name;
@ -12,58 +12,47 @@ let
models = [
(getmodel "en-default.pyrnn.gz"
"1xyi3k3p81mfw0491gb1haisazfyi2i18f1wjs1m34ak39qfqjdp")
(getmodel "en-uw3-linerel-2.cmodel.gz"
"0zdw0db2znxxd4h7aa09506nkbxd1cfqacxzyzlx42bjn951wcpw")
(getmodel "en-mixed-3.ngraphs.gz"
"1fqw7pxmjwapirp9xv3b0gn9pk53q4740qn5dw4wxfxk9dpp9lr4")
(getmodel "en-space.model.gz"
"0w5hnjm6rz5iiw1p2yixj147ifq11s9jfzrxk4v4xxmcyn365096")
(getmodel "en-mixed.lineest.gz"
"0skrziksn3zb3g8588y7jd10pnl2pzrby0119ac0awapzzg9vkvw")
(getmodel "uw3unlv.pyrnn.gz"
"0g08q9cjxxx3mg1jn4654nalxr56y2jq1h33pwxrj5lrckr7grb9")
(getmodel "en-uw3unlv-perchar.cmodel.gz"
"1izvm0wkb2vh58hjp59fw97drv17zdzrw6mz3aanrg5ax6fnfadk")
(getmodel "gradient.lineest.gz"
"1bw9hj9byjxi31rjh2xiysnx8c72jz0npxa54xgjwsqg7ihl8jzw")
(getmodel "en-mixed-round1.lineest.gz"
"1fjkygyrg4ng7kx4iqa4yhgvmw1zq72p3q5p0hcb2xxhqc04vx7c")
(getmodel "frakant.pyrnn.gz"
"0i1k95f2a8qlc6m7qq11pmjfcimyrjsfjvv20nrs2ygp9pwskmxp")
(getmodel "fraktur.pyrnn.gz"
"1wlwvxn91ilgmlri1hj81arl3mbzxc24ycdnkf5icq4hdi4c6y8b")
];
version = "20150316";
in
pythonPackages.buildPythonPackage rec {
pythonPackages.buildPythonPackage {
name = "ocropus-${version}";
version = "20130905";
src = fetchhg {
url = "https://code.google.com/p/ocropus.ocropy";
rev = "a6e0fbd820ce";
sha256 = "1s0v0gd6psfjp6lghwl2dj49h18mgf2n2z8hqzw8430nzhglnlvr";
src = fetchFromGitHub {
sha256 = "0m5bm2ah3p29c13vp7hz7rm058qnlm840zd8xv20byijhlz0447g";
rev = "5ba07bb959d605ec15424dd2b8f3d7245820084e";
repo = "ocropy";
owner = "tmbdev";
};
patches = [ ./display.patch ];
propagatedBuildInputs = with pythonPackages; [ curl numpy scipy pillow
matplotlib beautifulsoup4 pygtk lxml ];
enableParallelBuilding = true;
preConfigure = with stdenv.lib; ''
${concatStrings (map (x: "ln -s ${x.src} models/${x.name};") models)}
${concatStrings (map (x: "ln -s ${x.src} models/`basename ${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
substituteInPlace ocrolib/{common,default}.py --replace /usr/local $out
'';
checkPhase = ''
patchShebangs ./run-test
substituteInPlace ./run-test \
--replace 'ocropus-rpred' 'ocropus-rpred -Q $NIX_BUILD_CORES'
PATH=".:$PATH" ./run-test
'';
meta = with stdenv.lib; {
inherit version;
description = "Open source document analysis and OCR system";
license = licenses.asl20;
homepage = https://code.google.com/p/ocropus/;
maintainers = with maintainers; [ iElectric viric ];
homepage = https://github.com/tmbdev/ocropy/;
maintainers = with maintainers; [ iElectric nckx viric ];
platforms = platforms.linux;
};
}

View file

@ -1,17 +0,0 @@
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/"