Merge branch 'master' into staging-next
This commit is contained in:
@@ -15,7 +15,7 @@ buildPythonPackage rec {
|
||||
|
||||
patches = fetchpatch {
|
||||
name = "cheroot-fix-setup-python3.patch";
|
||||
url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/cheroot-fix-setup-python3.patch?h=packages/python-cheroot";
|
||||
url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/cheroot-fix-setup-python3.patch?h=packages/python-cheroot&id=9b33cb0885b3c0d91adeacae23761a4321eb0e64";
|
||||
sha256 = "1rlgz0qln536y00mfqlf0i9hz3f53id73wh47cg5q2vcsw1w2bpc";
|
||||
};
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Django";
|
||||
version = "2.1";
|
||||
version = "2.1.1";
|
||||
|
||||
disabled = !isPy3k;
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "0dv184lgp7scq8cr4422rrvkd8npyiqww0zw50ygcim5smw6093z";
|
||||
sha256 = "0b7p6d77xqs2hdq2k1amqgbr3050zn5i8asz5w2lxajqnvb1rk71";
|
||||
};
|
||||
|
||||
patches = stdenv.lib.optionals withGdal [
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
{ stdenv, buildPythonPackage, fetchPypi, flask, pyjwt, werkzeug, pytest }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Flask-JWT-Extended";
|
||||
version = "3.13.1";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "10qz3ljr2kpd93al2km6iijxp23z33kvvwd0y5bc840f86b4mra8";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ flask pyjwt werkzeug ];
|
||||
checkInputs = [ pytest ];
|
||||
|
||||
checkPhase = ''
|
||||
pytest tests/
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "JWT extension for Flask";
|
||||
homepage = https://flask-jwt-extended.readthedocs.io/;
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ gerschtli ];
|
||||
};
|
||||
}
|
||||
25
pkgs/development/python-modules/flask-sqlalchemy/default.nix
Normal file
25
pkgs/development/python-modules/flask-sqlalchemy/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ stdenv, buildPythonPackage, fetchPypi, flask, sqlalchemy, pytest }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "Flask-SQLAlchemy";
|
||||
version = "2.3.2";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "0lvfynbk9y0whpkhqz7kf3hk342sfa3lwqyv25gnb22q5f2vjwar";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ flask sqlalchemy ];
|
||||
checkInputs = [ pytest ];
|
||||
|
||||
checkPhase = ''
|
||||
pytest
|
||||
'';
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "SQLAlchemy extension for Flask";
|
||||
homepage = http://flask-sqlalchemy.pocoo.org/;
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ gerschtli ];
|
||||
};
|
||||
}
|
||||
37
pkgs/development/python-modules/glances/default.nix
Normal file
37
pkgs/development/python-modules/glances/default.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ buildPythonPackage, fetchFromGitHub, isPyPy, lib
|
||||
, psutil, setuptools, bottle, batinfo, pysnmp
|
||||
, hddtemp
|
||||
, unittest2
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
name = "glances-${version}";
|
||||
version = "3.0.2";
|
||||
disabled = isPyPy;
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "nicolargo";
|
||||
repo = "glances";
|
||||
rev = "v${version}";
|
||||
sha256 = "1jkjblfk4gbr00j7lny7ajiizzqnp0p1yhzfi14074gwk38z0q14";
|
||||
};
|
||||
|
||||
patches = lib.optional doCheck ./skip-failing-tests.patch;
|
||||
|
||||
# Requires access to /sys/class/power_supply
|
||||
doCheck = true;
|
||||
|
||||
buildInputs = [ unittest2 ];
|
||||
propagatedBuildInputs = [ psutil setuptools bottle batinfo pysnmp hddtemp ];
|
||||
|
||||
preConfigure = ''
|
||||
sed -i 's/data_files\.append((conf_path/data_files.append(("etc\/glances"/' setup.py;
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = https://nicolargo.github.io/glances/;
|
||||
description = "Cross-platform curses-based monitoring tool";
|
||||
license = licenses.lgpl3;
|
||||
maintainers = with maintainers; [ primeos koral ];
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
diff --git a/unitest.py b/unitest.py
|
||||
--- a/unitest.py
|
||||
+++ b/unitest.py
|
||||
@@ -59,6 +59,7 @@ class TestGlances(unittest.TestCase):
|
||||
"""The function is called *every time* before test_*."""
|
||||
print('\n' + '=' * 78)
|
||||
|
||||
+ @unittest.skip("Requires access to /etc/mtab")
|
||||
def test_000_update(self):
|
||||
"""Update stats (mandatory step for all the stats).
|
||||
|
||||
@@ -87,6 +88,7 @@ class TestGlances(unittest.TestCase):
|
||||
for plugin in plugins_to_check:
|
||||
self.assertTrue(plugin in plugins_list)
|
||||
|
||||
+ @unittest.skip("Fails on NixOS")
|
||||
def test_002_system(self):
|
||||
"""Check SYSTEM plugin."""
|
||||
stats_to_check = ['hostname', 'os_name']
|
||||
@@ -97,6 +99,7 @@ class TestGlances(unittest.TestCase):
|
||||
self.assertTrue(stat in stats_grab, msg='Cannot find key: %s' % stat)
|
||||
print('INFO: SYSTEM stats: %s' % stats_grab)
|
||||
|
||||
+ @unittest.skip("Fails on NixOS")
|
||||
def test_003_cpu(self):
|
||||
"""Check CPU plugin."""
|
||||
stats_to_check = ['system', 'user', 'idle']
|
||||
@@ -110,7 +113,7 @@ class TestGlances(unittest.TestCase):
|
||||
self.assertLessEqual(stats_grab[stat], 100)
|
||||
print('INFO: CPU stats: %s' % stats_grab)
|
||||
|
||||
- @unittest.skipIf(WINDOWS, "Load average not available on Windows")
|
||||
+ @unittest.skip("Fails on NixOS")
|
||||
def test_004_load(self):
|
||||
"""Check LOAD plugin."""
|
||||
stats_to_check = ['cpucore', 'min1', 'min5', 'min15']
|
||||
@@ -123,6 +126,7 @@ class TestGlances(unittest.TestCase):
|
||||
self.assertGreaterEqual(stats_grab[stat], 0)
|
||||
print('INFO: LOAD stats: %s' % stats_grab)
|
||||
|
||||
+ @unittest.skip("Fails on NixOS")
|
||||
def test_005_mem(self):
|
||||
"""Check MEM plugin."""
|
||||
stats_to_check = ['available', 'used', 'free', 'total']
|
||||
@@ -135,6 +139,7 @@ class TestGlances(unittest.TestCase):
|
||||
self.assertGreaterEqual(stats_grab[stat], 0)
|
||||
print('INFO: MEM stats: %s' % stats_grab)
|
||||
|
||||
+ @unittest.skip("Fails on NixOS")
|
||||
def test_006_swap(self):
|
||||
"""Check MEMSWAP plugin."""
|
||||
stats_to_check = ['used', 'free', 'total']
|
||||
@@ -4,11 +4,11 @@
|
||||
with stdenv.lib;
|
||||
buildPythonPackage rec {
|
||||
pname = "grpcio";
|
||||
version = "1.14.1";
|
||||
version = "1.15.0";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "4bf23666e763ca7ff6010465864e9f088f4ac7ecc1e11abd6f85b250e66b2c05";
|
||||
sha256 = "1lhh76kgyibgsk6c54nbzzhkskknkbvn71xvixsk0prfp8izr98m";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ] ++ optional stdenv.isDarwin darwin.cctools;
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "libvirt";
|
||||
version = "4.5.0";
|
||||
version = "4.7.0";
|
||||
|
||||
src = assert version == libvirt.version; fetchgit {
|
||||
url = git://libvirt.org/libvirt-python.git;
|
||||
rev = "v${version}";
|
||||
sha256 = "0w2rzkxv7jsq4670m0j5c6p4hpyi0r0ja6wd3wdvixcwc6hhx407";
|
||||
sha256 = "1zv3fgwmnkvqif0qsnvpx8hhb6bdfr2b4v55z3nh93bfg8s4rbm8";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ pkgconfig ];
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ stdenv, fetchPypi, python, buildPythonPackage, mpi, openssh }:
|
||||
{ stdenv, fetchPypi, fetchpatch, python, buildPythonPackage, mpi, openssh }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "mpi4py";
|
||||
@@ -13,6 +13,13 @@ buildPythonPackage rec {
|
||||
inherit mpi;
|
||||
};
|
||||
|
||||
patches = [ (fetchpatch {
|
||||
# Disable tests failing with 3.1.x and MPI_THREAD_MULTIPLE
|
||||
url = "https://bitbucket.org/mpi4py/mpi4py/commits/c2b6b7e642a182f9b00a2b8e9db363214470548a/raw";
|
||||
sha256 = "0n6bz3kj4vcqb6q7d0mlj5vl6apn7i2bvfc9mpg59vh3wy47119q";
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace test/test_spawn.py --replace \
|
||||
"unittest.skipMPI('openmpi(<3.0.0)')" \
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{ lib
|
||||
, fetchFromGitHub
|
||||
, buildPythonPackage
|
||||
, pytest
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@@ -14,6 +15,16 @@ buildPythonPackage rec {
|
||||
sha256 = "1pp561lj80jnvr2038nrzhmks2akxsbdqxvfrqa6n340x81981lm";
|
||||
};
|
||||
|
||||
checkInputs = [
|
||||
pytest
|
||||
];
|
||||
|
||||
checkPhase = ''
|
||||
runHook preCheck
|
||||
pytest -k "not TestActual"
|
||||
runHook postCheck
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "Get CPU info with pure Python 2 & 3";
|
||||
homepage = https://github.com/workhorsy/py-cpuinfo;
|
||||
|
||||
@@ -2,18 +2,15 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pynacl";
|
||||
version = "1.2.1";
|
||||
version = "1.3.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pyca";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "0z9i1z4hjzmp23igyhvg131gikbrr947506lwfb3fayf0agwfv8f";
|
||||
sha256 = "0ac00d5bfdmz1x428h2scq5b34llp61yhxradl94qjwz7ikqv052";
|
||||
};
|
||||
|
||||
# set timeout to unlimited, remove deadline from tests, see https://github.com/pyca/pynacl/issues/370
|
||||
patches = [ ./pynacl-no-timeout-and-deadline.patch ];
|
||||
|
||||
checkInputs = [ pytest hypothesis ];
|
||||
propagatedBuildInputs = [ libsodium cffi six ];
|
||||
|
||||
@@ -22,7 +19,7 @@ buildPythonPackage rec {
|
||||
checkPhase = ''
|
||||
py.test
|
||||
'';
|
||||
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
maintainers = with maintainers; [ va1entin ];
|
||||
description = "Python binding to the Networking and Cryptography (NaCl) library";
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
diff --git a/tests/test_pwhash.py b/tests/test_pwhash.py
|
||||
index 9634c85..7f20316 100644
|
||||
--- a/tests/test_pwhash.py
|
||||
+++ b/tests/test_pwhash.py
|
||||
@@ -20,7 +20,7 @@ import os
|
||||
import sys
|
||||
import unicodedata as ud
|
||||
|
||||
-from hypothesis import given, settings
|
||||
+from hypothesis import given, settings, unlimited
|
||||
from hypothesis.strategies import integers, text
|
||||
|
||||
import pytest
|
||||
@@ -411,7 +411,7 @@ def test_str_verify_argon2_ref_fail(password_hash, password):
|
||||
integers(min_value=1024 * 1024,
|
||||
max_value=16 * 1024 * 1024)
|
||||
)
|
||||
-@settings(deadline=1500, max_examples=20)
|
||||
+@settings(timeout=unlimited, deadline=None, max_examples=20)
|
||||
def test_argon2i_str_and_verify(password, ops, mem):
|
||||
_psw = password.encode('utf-8')
|
||||
pw_hash = nacl.pwhash.argon2i.str(_psw, opslimit=ops, memlimit=mem)
|
||||
@@ -425,7 +425,7 @@ def test_argon2i_str_and_verify(password, ops, mem):
|
||||
integers(min_value=1024 * 1024,
|
||||
max_value=16 * 1024 * 1024)
|
||||
)
|
||||
-@settings(deadline=1500, max_examples=20)
|
||||
+@settings(timeout=unlimited, deadline=None, max_examples=20)
|
||||
def test_argon2id_str_and_verify(password, ops, mem):
|
||||
_psw = password.encode('utf-8')
|
||||
pw_hash = nacl.pwhash.argon2id.str(_psw, opslimit=ops, memlimit=mem)
|
||||
@@ -439,7 +439,7 @@ def test_argon2id_str_and_verify(password, ops, mem):
|
||||
integers(min_value=1024 * 1024,
|
||||
max_value=16 * 1024 * 1024)
|
||||
)
|
||||
-@settings(deadline=1500, max_examples=20)
|
||||
+@settings(timeout=unlimited, deadline=None, max_examples=20)
|
||||
def test_argon2i_str_and_verify_fail(password, ops, mem):
|
||||
_psw = password.encode('utf-8')
|
||||
pw_hash = nacl.pwhash.argon2i.str(_psw, opslimit=ops, memlimit=mem)
|
||||
@@ -448,7 +448,7 @@ def test_argon2i_str_and_verify_fail(password, ops, mem):
|
||||
|
||||
|
||||
@given(text(alphabet=PASSWD_CHARS, min_size=5, max_size=20))
|
||||
-@settings(deadline=1500, max_examples=5)
|
||||
+@settings(timeout=unlimited, deadline=None, max_examples=5)
|
||||
def test_pwhash_str_and_verify(password):
|
||||
_psw = password.encode('utf-8')
|
||||
|
||||
@@ -1,47 +1,39 @@
|
||||
{ lib, fetchFromGitHub, buildPythonPackage, pillow, six
|
||||
, tesseract, cuneiform, isPy3k
|
||||
{ lib, fetchFromGitLab, buildPythonPackage, pillow, six
|
||||
, tesseract, cuneiform, isPy3k, substituteAll, pytest, tox
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pyocr";
|
||||
version = "0.4.7";
|
||||
version = "0.5.3";
|
||||
name = pname + "-" + version;
|
||||
disabled = !isPy3k;
|
||||
|
||||
# Don't fetch from PYPI because it doesn't contain tests.
|
||||
src = fetchFromGitHub {
|
||||
owner = "jflesch";
|
||||
src = fetchFromGitLab {
|
||||
domain = "gitlab.gnome.org";
|
||||
group = "World";
|
||||
owner = "OpenPaperwork";
|
||||
repo = "pyocr";
|
||||
rev = version;
|
||||
sha256 = "1iw73r8yrgjf8g00yzpz62ymqbf89cqhyhl9g430srmsrq7mn2yd";
|
||||
sha256 = "1nihf0qmbpg3yj3yp11jp6hp5z5dqf39nz6j9lqbvgi1nqbs7x15";
|
||||
};
|
||||
|
||||
NIX_CUNEIFORM_CMD = "${cuneiform}/bin/cuneiform";
|
||||
NIX_CUNEIFORM_DATA = "${cuneiform}/share/cuneiform";
|
||||
NIX_LIBTESSERACT_PATH = "${tesseract}/lib/libtesseract.so";
|
||||
NIX_TESSDATA_PREFIX = "${tesseract}/share/tessdata";
|
||||
NIX_TESSERACT_CMD = "${tesseract}/bin/tesseract";
|
||||
|
||||
patches = [ ./paths.patch ];
|
||||
patches = [ (substituteAll {
|
||||
src = ./paths.patch;
|
||||
inherit cuneiform tesseract;
|
||||
})
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace src/pyocr/cuneiform.py \
|
||||
--subst-var NIX_CUNEIFORM_CMD \
|
||||
--subst-var NIX_CUNEIFORM_CMD
|
||||
|
||||
substituteInPlace src/pyocr/tesseract.py \
|
||||
--subst-var NIX_TESSERACT_CMD
|
||||
|
||||
substituteInPlace src/pyocr/libtesseract/tesseract_raw.py \
|
||||
--subst-var NIX_TESSDATA_PREFIX \
|
||||
--subst-var NIX_LIBTESSERACT_PATH
|
||||
echo 'version = "${version}"' > src/pyocr/_version.py
|
||||
|
||||
# Disable specific tests that are probably failing because of this issue:
|
||||
# https://github.com/jflesch/pyocr/issues/52
|
||||
for test in $disabledTests; do
|
||||
file="''${test%%:*}"
|
||||
fun="''${test#*:}"
|
||||
echo "$fun = unittest.skip($fun)" >> "tests/tests_$file.py"
|
||||
echo "import pytest" >> "tests/tests_$file.py"
|
||||
echo "$fun = pytest.mark.skip($fun)" >> "tests/tests_$file.py"
|
||||
done
|
||||
'';
|
||||
|
||||
@@ -57,14 +49,18 @@ buildPythonPackage rec {
|
||||
"libtesseract:TestLineBox.test_japanese"
|
||||
"libtesseract:TestTxt.test_japanese"
|
||||
"libtesseract:TestWordBox.test_japanese"
|
||||
"libtesseract:TestTxt.test_multi"
|
||||
"tesseract:TestTxt.test_multi"
|
||||
"tesseract:TestDigitLineBox.test_digits"
|
||||
"tesseract:TestTxt.test_japanese"
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [ pillow six ];
|
||||
checkInputs = [ pytest tox ];
|
||||
checkPhase = "pytest";
|
||||
|
||||
meta = {
|
||||
homepage = "https://github.com/jflesch/pyocr";
|
||||
inherit (src.meta) homepage;
|
||||
description = "A Python wrapper for Tesseract and Cuneiform";
|
||||
license = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
diff --git a/src/pyocr/cuneiform.py b/src/pyocr/cuneiform.py
|
||||
index a461d92..1f2b914 100644
|
||||
--- a/src/pyocr/cuneiform.py
|
||||
+++ b/src/pyocr/cuneiform.py
|
||||
Index: current/src/pyocr/cuneiform.py
|
||||
===================================================================
|
||||
--- current.orig/src/pyocr/cuneiform.py
|
||||
+++ current/src/pyocr/cuneiform.py
|
||||
@@ -27,13 +27,9 @@ from . import error
|
||||
from . import util
|
||||
|
||||
|
||||
-# CHANGE THIS IF CUNEIFORM IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY
|
||||
-CUNEIFORM_CMD = 'cuneiform'
|
||||
+CUNEIFORM_CMD = '@NIX_CUNEIFORM_CMD@'
|
||||
+CUNEIFORM_CMD = '@cuneiform@/bin/cuneiform'
|
||||
|
||||
-CUNEIFORM_DATA_POSSIBLE_PATHS = [
|
||||
- "/usr/local/share/cuneiform",
|
||||
- "/usr/share/cuneiform",
|
||||
-]
|
||||
+CUNEIFORM_DATA_POSSIBLE_PATHS = ['@NIX_CUNEIFORM_DATA@']
|
||||
+CUNEIFORM_DATA_POSSIBLE_PATHS = ['@cuneiform@/share/cuneiform']
|
||||
|
||||
LANGUAGES_LINE_PREFIX = "Supported languages: "
|
||||
LANGUAGES_SPLIT_RE = re.compile("[^a-z]")
|
||||
diff --git a/src/pyocr/libtesseract/tesseract_raw.py b/src/pyocr/libtesseract/tesseract_raw.py
|
||||
index b4e7bda..47505f7 100644
|
||||
--- a/src/pyocr/libtesseract/tesseract_raw.py
|
||||
+++ b/src/pyocr/libtesseract/tesseract_raw.py
|
||||
@@ -1,55 +1,13 @@
|
||||
Index: current/src/pyocr/libtesseract/tesseract_raw.py
|
||||
===================================================================
|
||||
--- current.orig/src/pyocr/libtesseract/tesseract_raw.py
|
||||
+++ current/src/pyocr/libtesseract/tesseract_raw.py
|
||||
@@ -1,52 +1,13 @@
|
||||
import ctypes
|
||||
import logging
|
||||
import os
|
||||
@@ -56,7 +56,13 @@ index b4e7bda..47505f7 100644
|
||||
- # Jflesch> Don't they have the equivalent of LD_LIBRARY_PATH on
|
||||
- # Windows ?
|
||||
- "../vs2010/DLL_Release/libtesseract302.dll",
|
||||
- # prefer the most recent first
|
||||
- "libtesseract305.dll",
|
||||
- "libtesseract304.dll",
|
||||
- "libtesseract303.dll",
|
||||
- "libtesseract302.dll",
|
||||
- "libtesseract400.dll", # Tesseract 4 is still in alpha stage
|
||||
- "libtesseract.dll",
|
||||
- "C:\\Program Files (x86)\\Tesseract-OCR\\libtesseract-4.dll",
|
||||
- "C:\\Program Files (x86)\\Tesseract-OCR\\libtesseract-3.dll",
|
||||
- ]
|
||||
@@ -66,27 +72,18 @@ index b4e7bda..47505f7 100644
|
||||
- "libtesseract.so.3",
|
||||
- ]
|
||||
-
|
||||
-
|
||||
-g_libtesseract = None
|
||||
-
|
||||
-for libname in libnames:
|
||||
- try:
|
||||
- g_libtesseract = ctypes.cdll.LoadLibrary(libname)
|
||||
- break
|
||||
- except OSError:
|
||||
- pass
|
||||
+g_libtesseract = ctypes.cdll.LoadLibrary('@NIX_LIBTESSERACT_PATH@')
|
||||
+libnames = [ "@tesseract@/lib/libtesseract.so" ]
|
||||
|
||||
g_libtesseract = None
|
||||
|
||||
class PageSegMode(object):
|
||||
@@ -326,12 +284,11 @@ def init(lang=None):
|
||||
@@ -346,12 +307,11 @@ def init(lang=None):
|
||||
try:
|
||||
if lang:
|
||||
lang = lang.encode("utf-8")
|
||||
- prefix = None
|
||||
- if TESSDATA_PREFIX:
|
||||
- prefix = TESSDATA_PREFIX.encode("utf-8")
|
||||
+ prefix = os.getenv('TESSDATA_PREFIX', '@NIX_TESSDATA_PREFIX@')
|
||||
+ prefix = os.getenv('TESSDATA_PREFIX', '@tesseract@/share/tessdata')
|
||||
+ os.environ['TESSDATA_PREFIX'] = prefix
|
||||
g_libtesseract.TessBaseAPIInit3(
|
||||
ctypes.c_void_p(handle),
|
||||
@@ -95,17 +92,17 @@ index b4e7bda..47505f7 100644
|
||||
ctypes.c_char_p(lang)
|
||||
)
|
||||
g_libtesseract.TessBaseAPISetVariable(
|
||||
diff --git a/src/pyocr/tesseract.py b/src/pyocr/tesseract.py
|
||||
index c935881..7139ffe 100755
|
||||
--- a/src/pyocr/tesseract.py
|
||||
+++ b/src/pyocr/tesseract.py
|
||||
@@ -31,8 +31,7 @@ from .builders import DigitBuilder # backward compatibility
|
||||
Index: current/src/pyocr/tesseract.py
|
||||
===================================================================
|
||||
--- current.orig/src/pyocr/tesseract.py
|
||||
+++ current/src/pyocr/tesseract.py
|
||||
@@ -31,8 +31,7 @@ from .builders import DigitBuilder # ba
|
||||
from .error import TesseractError # backward compatibility
|
||||
from .util import digits_only
|
||||
|
||||
-# CHANGE THIS IF TESSERACT IS NOT IN YOUR PATH, OR IS NAMED DIFFERENTLY
|
||||
-TESSERACT_CMD = 'tesseract.exe' if os.name == 'nt' else 'tesseract'
|
||||
+TESSERACT_CMD = '@NIX_TESSERACT_CMD@'
|
||||
+TESSERACT_CMD = '@tesseract@/bin/tesseract'
|
||||
|
||||
TESSDATA_EXTENSION = ".traineddata"
|
||||
|
||||
|
||||
38
pkgs/development/python-modules/pypillowfight/default.nix
Normal file
38
pkgs/development/python-modules/pypillowfight/default.nix
Normal file
@@ -0,0 +1,38 @@
|
||||
{ stdenv, buildPythonPackage, fetchFromGitLab, nose, pillow
|
||||
, isPy3k, isPyPy
|
||||
}:
|
||||
buildPythonPackage rec {
|
||||
name = "pypillowfight-${version}";
|
||||
version = "0.2.4";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
domain = "gitlab.gnome.org";
|
||||
group = "World";
|
||||
owner = "OpenPaperwork";
|
||||
repo = "libpillowfight";
|
||||
rev = version;
|
||||
sha256 = "0wbzfhbzim61fmkm7p7f2rwslacla1x00a6xp50haawjh9zfwc4y";
|
||||
};
|
||||
|
||||
prePatch = ''
|
||||
echo '#define INTERNAL_PILLOWFIGHT_VERSION "${version}"' > src/pillowfight/_version.h
|
||||
'';
|
||||
|
||||
# Disable tests because they're designed to only work on Debian:
|
||||
# https://github.com/jflesch/libpillowfight/issues/2#issuecomment-268259174
|
||||
doCheck = false;
|
||||
|
||||
# Python 2.x is not supported, see:
|
||||
# https://github.com/jflesch/libpillowfight/issues/1
|
||||
disabled = !isPy3k && !isPyPy;
|
||||
|
||||
# This is needed by setup.py regardless of whether tests are enabled.
|
||||
buildInputs = [ nose ];
|
||||
propagatedBuildInputs = [ pillow ];
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "Library containing various image processing algorithms";
|
||||
inherit (src.meta) homepage;
|
||||
license = licenses.gpl3Plus;
|
||||
};
|
||||
}
|
||||
23
pkgs/development/python-modules/pystemd/default.nix
Normal file
23
pkgs/development/python-modules/pystemd/default.nix
Normal file
@@ -0,0 +1,23 @@
|
||||
{ stdenv, buildPythonPackage, fetchPypi, mock, pytest, six, systemd }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pystemd";
|
||||
version = "0.5.0";
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "000001hxv25vwcsvc0avg42v89c7qcjdpw6dr8419prmcb9186i5";
|
||||
};
|
||||
|
||||
buildInputs = [ systemd ];
|
||||
propagatedBuildInputs = [ six ];
|
||||
|
||||
checkInputs = [ pytest mock ];
|
||||
checkPhase = "pytest tests";
|
||||
|
||||
meta = with stdenv.lib; {
|
||||
description = "A thin Cython-based wrapper on top of libsystemd, focused on exposing the dbus API via sd-bus in an automated and easy to consume way.";
|
||||
homepage = https://github.com/facebookincubator/pystemd/;
|
||||
license = licenses.bsd0;
|
||||
maintainers = with maintainers; [ flokli ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user