git.iko.soy/typeable/nixpkgs
on master help sign in
Merge Paperwork update to version 1.2.4 (#46487)

Thanks to @symphorien for this work, which apart from the update itself includes a few more fixes and cleanups. I've tested building and running the upgraded Paperwork and while I haven't done extensive testing on every little feature it seems to work so far. The changes also include an addition to fetchFromGitLab, which allows to specify a group. Merges: #46487

commit65d0b082f372f1f3fc7afbc9543ab5e8b09cf1ae authoraszlig <aszlig@nix.build> dateTue 25 Sep 2018, 23:09 (8 years ago) parent4ad424f46cd67e
7 files changed+114−103
pkgs/applications/office/paperwork/backend.nix+14−6 pkgs/applications/office/paperwork/default.nix+9−9 pkgs/development/python-modules/pyocr/default.nix+21−25 pkgs/development/python-modules/pyocr/paths.patch+27−30 pkgs/development/python-modules/pypillowfight/default.nix+38 pkgs/top-level/all-packages.nix+4−4 pkgs/top-level/python-packages.nix+1−29
pkgs/applications/office/paperwork/backend.nix+14−6
@@ -1,4 +1,4 @@
1−{ buildPythonPackage, lib, fetchFromGitHub
1+{ buildPythonPackage, lib, fetchFromGitLab
22
33, isPy3k, isPyPy
44
@@ -10,18 +10,26 @@
1010
1111buildPythonPackage rec {
1212 pname = "paperwork-backend";
13− version = "1.2.2";
13+ version = "1.2.4";
1414
15− src = fetchFromGitHub {
16− owner = "openpaperwork";
17− repo = "paperwork-backend";
15+ src = fetchFromGitLab {
16+ domain = "gitlab.gnome.org";
17+ repo = "paperwork";
18+ group = "World";
19+ owner = "OpenPaperwork";
1820 rev = version;
19− sha256 = "1rvf06vphm32601ja1bfkfkfpgjxiv0lh4yxjy31jll0bfnsf7pf";
21+ sha256 = "0wjjiw99aswmppnhzq3jir0p5p78r3m8hjinhdirkgm6h7skq5p4";
2022 };
2123
24+ sourceRoot = "source/paperwork-backend";
25+
2226 # Python 2.x is not supported.
2327 disabled = !isPy3k && !isPyPy;
2428
29+ patchPhase = ''
30+ echo 'version = "${version}"' > paperwork_backend/_version.py
31+ '';
32+
2533 preCheck = "\"$out/bin/paperwork-shell\" chkdeps paperwork_backend";
2634
2735 propagatedBuildInputs = [
pkgs/applications/office/paperwork/default.nix+9−9
@@ -1,20 +1,14 @@
1−{ lib, python3Packages, fetchFromGitHub, gtk3, cairo
1+{ lib, python3Packages, fetchFromGitLab, gtk3, cairo
22, aspellDicts, buildEnv
33, gnome3, hicolor-icon-theme, librsvg
44, xvfb_run, dbus, libnotify
55}:
66
77python3Packages.buildPythonApplication rec {
8+ inherit (python3Packages.paperwork-backend) version src;
89 name = "paperwork-${version}";
9− # Don't forget to also update paperwork-backend when updating this!
10− version = "1.2.2";
1110
12− src = fetchFromGitHub {
13− repo = "paperwork";
14− owner = "openpaperwork";
15− rev = version;
16− sha256 = "1nb5sna2s952xb7c89qccg9qp693pyqj8g7xz16ll16ydfqnzsdk";
17− };
11+ sourceRoot = "source/paperwork-gtk";
1812
1913 # Patch out a few paths that assume that we're using the FHS:
2014 postPatch = ''
@@ -39,6 +33,12 @@ python3Packages.buildPythonApplication rec {
3933
4034 sed -i -e 's/"logo"/"logo-icon-name"/g' \
4135 src/paperwork/frontend/aboutdialog/aboutdialog.glade
36+
37+ cat - ../AUTHORS.py > src/paperwork/_version.py <<EOF
38+ # -*- coding: utf-8 -*-
39+ version = "${version}"
40+ authors_code=""
41+ EOF
4242 '';
4343
4444 ASPELL_CONF = "dict-dir ${buildEnv {
pkgs/development/python-modules/pyocr/default.nix+21−25
@@ -1,47 +1,39 @@
1−{ lib, fetchFromGitHub, buildPythonPackage, pillow, six
2−, tesseract, cuneiform, isPy3k
1+{ lib, fetchFromGitLab, buildPythonPackage, pillow, six
2+, tesseract, cuneiform, isPy3k, substituteAll, pytest, tox
33}:
44
55buildPythonPackage rec {
66 pname = "pyocr";
7− version = "0.4.7";
7+ version = "0.5.3";
88 name = pname + "-" + version;
99 disabled = !isPy3k;
1010
1111 # Don't fetch from PYPI because it doesn't contain tests.
12− src = fetchFromGitHub {
13− owner = "jflesch";
12+ src = fetchFromGitLab {
13+ domain = "gitlab.gnome.org";
14+ group = "World";
15+ owner = "OpenPaperwork";
1416 repo = "pyocr";
1517 rev = version;
16− sha256 = "1iw73r8yrgjf8g00yzpz62ymqbf89cqhyhl9g430srmsrq7mn2yd";
18+ sha256 = "1nihf0qmbpg3yj3yp11jp6hp5z5dqf39nz6j9lqbvgi1nqbs7x15";
1719 };
1820
19− NIX_CUNEIFORM_CMD = "${cuneiform}/bin/cuneiform";
20− NIX_CUNEIFORM_DATA = "${cuneiform}/share/cuneiform";
21− NIX_LIBTESSERACT_PATH = "${tesseract}/lib/libtesseract.so";
22− NIX_TESSDATA_PREFIX = "${tesseract}/share/tessdata";
23− NIX_TESSERACT_CMD = "${tesseract}/bin/tesseract";
24−
25− patches = [ ./paths.patch ];
21+ patches = [ (substituteAll {
22+ src = ./paths.patch;
23+ inherit cuneiform tesseract;
24+ })
25+ ];
2626
2727 postPatch = ''
28− substituteInPlace src/pyocr/cuneiform.py \
29− --subst-var NIX_CUNEIFORM_CMD \
30− --subst-var NIX_CUNEIFORM_CMD
31−
32− substituteInPlace src/pyocr/tesseract.py \
33− --subst-var NIX_TESSERACT_CMD
34−
35− substituteInPlace src/pyocr/libtesseract/tesseract_raw.py \
36− --subst-var NIX_TESSDATA_PREFIX \
37− --subst-var NIX_LIBTESSERACT_PATH
28+ echo 'version = "${version}"' > src/pyocr/_version.py
3829
3930 # Disable specific tests that are probably failing because of this issue:
4031 # https://github.com/jflesch/pyocr/issues/52
4132 for test in $disabledTests; do
4233 file="''${test%%:*}"
4334 fun="''${test#*:}"
44− echo "$fun = unittest.skip($fun)" >> "tests/tests_$file.py"
35+ echo "import pytest" >> "tests/tests_$file.py"
36+ echo "$fun = pytest.mark.skip($fun)" >> "tests/tests_$file.py"
4537 done
4638 '';
4739
@@ -57,14 +49,18 @@ buildPythonPackage rec {
5749 "libtesseract:TestLineBox.test_japanese"
5850 "libtesseract:TestTxt.test_japanese"
5951 "libtesseract:TestWordBox.test_japanese"
52+ "libtesseract:TestTxt.test_multi"
53+ "tesseract:TestTxt.test_multi"
6054 "tesseract:TestDigitLineBox.test_digits"
6155 "tesseract:TestTxt.test_japanese"
6256 ];
6357
6458 propagatedBuildInputs = [ pillow six ];
59+ checkInputs = [ pytest tox ];
60+ checkPhase = "pytest";
6561
6662 meta = {
67− homepage = "https://github.com/jflesch/pyocr";
63+ inherit (src.meta) homepage;
6864 description = "A Python wrapper for Tesseract and Cuneiform";
6965 license = lib.licenses.gpl3Plus;
7066 };
pkgs/development/python-modules/pyocr/paths.patch+27−30
@@ -1,28 +1,28 @@
1−diff --git a/src/pyocr/cuneiform.py b/src/pyocr/cuneiform.py
2−index a461d92..1f2b914 100644
3−--- a/src/pyocr/cuneiform.py
4−+++ b/src/pyocr/cuneiform.py
1+Index: current/src/pyocr/cuneiform.py
2+===================================================================
3+--- current.orig/src/pyocr/cuneiform.py
4++++ current/src/pyocr/cuneiform.py
55@@ -27,13 +27,9 @@ from . import error
66 from . import util
77
88
99-# CHANGE THIS IF CUNEIFORM IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY
1010-CUNEIFORM_CMD = 'cuneiform'
11−+CUNEIFORM_CMD = '@NIX_CUNEIFORM_CMD@'
11++CUNEIFORM_CMD = '@cuneiform@/bin/cuneiform'
1212
1313-CUNEIFORM_DATA_POSSIBLE_PATHS = [
1414- "/usr/local/share/cuneiform",
1515- "/usr/share/cuneiform",
1616-]
17−+CUNEIFORM_DATA_POSSIBLE_PATHS = ['@NIX_CUNEIFORM_DATA@']
17++CUNEIFORM_DATA_POSSIBLE_PATHS = ['@cuneiform@/share/cuneiform']
1818
1919 LANGUAGES_LINE_PREFIX = "Supported languages: "
2020 LANGUAGES_SPLIT_RE = re.compile("[^a-z]")
21−diff --git a/src/pyocr/libtesseract/tesseract_raw.py b/src/pyocr/libtesseract/tesseract_raw.py
22−index b4e7bda..47505f7 100644
23−--- a/src/pyocr/libtesseract/tesseract_raw.py
24−+++ b/src/pyocr/libtesseract/tesseract_raw.py
25−@@ -1,55 +1,13 @@
21+Index: current/src/pyocr/libtesseract/tesseract_raw.py
22+===================================================================
23+--- current.orig/src/pyocr/libtesseract/tesseract_raw.py
24++++ current/src/pyocr/libtesseract/tesseract_raw.py
25+@@ -1,52 +1,13 @@
2626 import ctypes
2727 import logging
2828 import os
@@ -56,7 +56,13 @@ index b4e7bda..47505f7 100644
5656- # Jflesch> Don't they have the equivalent of LD_LIBRARY_PATH on
5757- # Windows ?
5858- "../vs2010/DLL_Release/libtesseract302.dll",
59+- # prefer the most recent first
60+- "libtesseract305.dll",
61+- "libtesseract304.dll",
62+- "libtesseract303.dll",
5963- "libtesseract302.dll",
64+- "libtesseract400.dll", # Tesseract 4 is still in alpha stage
65+- "libtesseract.dll",
6066- "C:\\Program Files (x86)\\Tesseract-OCR\\libtesseract-4.dll",
6167- "C:\\Program Files (x86)\\Tesseract-OCR\\libtesseract-3.dll",
6268- ]
@@ -66,27 +72,18 @@ index b4e7bda..47505f7 100644
6672- "libtesseract.so.3",
6773- ]
6874-
69−-
70−-g_libtesseract = None
71−-
72−-for libname in libnames:
73−- try:
74−- g_libtesseract = ctypes.cdll.LoadLibrary(libname)
75−- break
76−- except OSError:
77−- pass
78−+g_libtesseract = ctypes.cdll.LoadLibrary('@NIX_LIBTESSERACT_PATH@')
75++libnames = [ "@tesseract@/lib/libtesseract.so" ]
7976
77+ g_libtesseract = None
8078
81− class PageSegMode(object):
82−@@ -326,12 +284,11 @@ def init(lang=None):
79+@@ -346,12 +307,11 @@ def init(lang=None):
8380 try:
8481 if lang:
8582 lang = lang.encode("utf-8")
8683- prefix = None
8784- if TESSDATA_PREFIX:
8885- prefix = TESSDATA_PREFIX.encode("utf-8")
89−+ prefix = os.getenv('TESSDATA_PREFIX', '@NIX_TESSDATA_PREFIX@')
86++ prefix = os.getenv('TESSDATA_PREFIX', '@tesseract@/share/tessdata')
9087+ os.environ['TESSDATA_PREFIX'] = prefix
9188 g_libtesseract.TessBaseAPIInit3(
9289 ctypes.c_void_p(handle),
@@ -95,17 +92,17 @@ index b4e7bda..47505f7 100644
9592 ctypes.c_char_p(lang)
9693 )
9794 g_libtesseract.TessBaseAPISetVariable(
98−diff --git a/src/pyocr/tesseract.py b/src/pyocr/tesseract.py
99−index c935881..7139ffe 100755
100−--- a/src/pyocr/tesseract.py
101−+++ b/src/pyocr/tesseract.py
102−@@ -31,8 +31,7 @@ from .builders import DigitBuilder # backward compatibility
95+Index: current/src/pyocr/tesseract.py
96+===================================================================
97+--- current.orig/src/pyocr/tesseract.py
98++++ current/src/pyocr/tesseract.py
99+@@ -31,8 +31,7 @@ from .builders import DigitBuilder # ba
103100 from .error import TesseractError # backward compatibility
104101 from .util import digits_only
105102
106103-# CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY
107104-TESSERACT_CMD = 'tesseract.exe' if os.name == 'nt' else 'tesseract'
108−+TESSERACT_CMD = '@NIX_TESSERACT_CMD@'
105++TESSERACT_CMD = '@tesseract@/bin/tesseract'
109106
110107 TESSDATA_EXTENSION = ".traineddata"
111108
pkgs/development/python-modules/pypillowfight/default.nixnew file+38
@@ -0,0 +1,38 @@
1+{ stdenv, buildPythonPackage, fetchFromGitLab, nose, pillow
2+, isPy3k, isPyPy
3+}:
4+buildPythonPackage rec {
5+ name = "pypillowfight-${version}";
6+ version = "0.2.4";
7+
8+ src = fetchFromGitLab {
9+ domain = "gitlab.gnome.org";
10+ group = "World";
11+ owner = "OpenPaperwork";
12+ repo = "libpillowfight";
13+ rev = version;
14+ sha256 = "0wbzfhbzim61fmkm7p7f2rwslacla1x00a6xp50haawjh9zfwc4y";
15+ };
16+
17+ prePatch = ''
18+ echo '#define INTERNAL_PILLOWFIGHT_VERSION "${version}"' > src/pillowfight/_version.h
19+ '';
20+
21+ # Disable tests because they're designed to only work on Debian:
22+ # https://github.com/jflesch/libpillowfight/issues/2#issuecomment-268259174
23+ doCheck = false;
24+
25+ # Python 2.x is not supported, see:
26+ # https://github.com/jflesch/libpillowfight/issues/1
27+ disabled = !isPy3k && !isPyPy;
28+
29+ # This is needed by setup.py regardless of whether tests are enabled.
30+ buildInputs = [ nose ];
31+ propagatedBuildInputs = [ pillow ];
32+
33+ meta = with stdenv.lib; {
34+ description = "Library containing various image processing algorithms";
35+ inherit (src.meta) homepage;
36+ license = licenses.gpl3Plus;
37+ };
38+}
pkgs/top-level/all-packages.nix+4−4
@@ -288,13 +288,13 @@ with pkgs;
288288
289289 # gitlab example
290290 fetchFromGitLab = {
291− owner, repo, rev, domain ? "gitlab.com", name ? "source",
291+ owner, repo, rev, domain ? "gitlab.com", name ? "source", group ? null,
292292 ... # For hash agility
293293 }@args: fetchzip ({
294294 inherit name;
295− url = "https://${domain}/api/v4/projects/${owner}%2F${repo}/repository/archive.tar.gz?sha=${rev}";
296− meta.homepage = "https://${domain}/${owner}/${repo}/";
297− } // removeAttrs args [ "domain" "owner" "repo" "rev" ]) // { inherit rev; };
295+ url = "https://${domain}/api/v4/projects/${lib.optionalString (group != null) group+"%2F"}${owner}%2F${repo}/repository/archive.tar.gz?sha=${rev}";
296+ meta.homepage = "https://${domain}/${lib.optionalString (group != null) group+"/"}${owner}/${repo}/";
297+ } // removeAttrs args [ "domain" "owner" "group" "repo" "rev" ]) // { inherit rev; };
298298
299299 # gitweb example, snapshot support is optional in gitweb
300300 fetchFromRepoOrCz = {
pkgs/top-level/python-packages.nix+1−29
@@ -3869,35 +3869,7 @@ in {
38693869 };
38703870 };
38713871
3872− pypillowfight = buildPythonPackage rec {
3873− name = "pypillowfight-${version}";
3874− version = "0.2.1";
3875−
3876− src = pkgs.fetchFromGitHub {
3877− owner = "jflesch";
3878− repo = "libpillowfight";
3879− rev = version;
3880− sha256 = "1rwmajsy9qhl3qhhy5mw0xmr3n8abxcq8baidpn0sxv6yjg2369z";
3881− };
3882−
3883− # Disable tests because they're designed to only work on Debian:
3884− # https://github.com/jflesch/libpillowfight/issues/2#issuecomment-268259174
3885− doCheck = false;
3886−
3887− # Python 2.x is not supported, see:
3888− # https://github.com/jflesch/libpillowfight/issues/1
3889− disabled = !isPy3k && !isPyPy;
3890−
3891− # This is needed by setup.py regardless of whether tests are enabled.
3892− buildInputs = [ self.nose ];
3893− propagatedBuildInputs = [ self.pillow ];
3894−
3895− meta = {
3896− description = "Library containing various image processing algorithms";
3897− homepage = "https://github.com/jflesch/libpillowfight";
3898− license = licenses.gpl3Plus;
3899− };
3900− };
3872+ pypillowfight = callPackage ../development/python-modules/pypillowfight { };
39013873
39023874 pyprind = callPackage ../development/python-modules/pyprind { };
39033875