2018-10-27 14:17:52 +01:00
|
|
|
{ buildPythonPackage, python, tornado, pycrypto, pycurl, pytz
|
|
|
|
, pillow, derpconf, python_magic, libthumbor, webcolors
|
|
|
|
, piexif, futures, statsd, thumborPexif, fetchFromGitHub, isPy3k, lib
|
2019-03-13 22:38:32 +00:00
|
|
|
, mock, raven, nose, yanc, remotecv, pyssim, cairosvg, preggy, opencv3
|
2019-03-11 22:15:40 +00:00
|
|
|
, pkgs, coreutils, substituteAll
|
2018-03-15 21:34:10 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "thumbor";
|
2019-03-11 22:15:40 +00:00
|
|
|
version = "6.7.0";
|
2018-03-15 21:34:10 +00:00
|
|
|
|
2018-03-19 07:49:28 +00:00
|
|
|
disabled = isPy3k; # see https://github.com/thumbor/thumbor/issues/1004
|
|
|
|
|
2018-10-27 14:17:52 +01:00
|
|
|
# Tests aren't included in PyPI tarball so use GitHub instead
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2019-03-11 22:15:40 +00:00
|
|
|
sha256 = "1qv02jz7ivn38dsywp7nxrlflly86x9pm2pk3yqi8m8myhc7lipg";
|
2018-03-15 21:34:10 +00:00
|
|
|
};
|
|
|
|
|
2019-03-11 22:15:40 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./0001-Don-t-use-which-implementation-to-find-required-exec.patch;
|
|
|
|
gifsicle = "${pkgs.gifsicle}/bin/gifsicle";
|
|
|
|
exiftool = "${pkgs.exiftool}/bin/exiftool";
|
|
|
|
jpegtran = "${pkgs.libjpeg}/bin/jpegtran";
|
2020-06-07 13:39:09 +01:00
|
|
|
ffmpeg = "${pkgs.ffmpeg_3}/bin/ffmpeg";
|
2019-03-11 22:15:40 +00:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2018-03-15 21:34:10 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace "setup.py" \
|
|
|
|
--replace '"argparse",' "" ${lib.optionalString isPy3k ''--replace '"futures",' ""''}
|
2018-12-22 08:09:17 +00:00
|
|
|
sed -i setup.py \
|
|
|
|
-e 's/piexif[^"]*/piexif/;s/Pillow[^"]*/Pillow/'
|
2018-10-27 14:17:52 +01:00
|
|
|
substituteInPlace "tests/test_utils.py" \
|
|
|
|
--replace "/bin/ls" "${coreutils}/bin/ls"
|
|
|
|
substituteInPlace "tests/detectors/test_face_detector.py" \
|
|
|
|
--replace "./thumbor" "$out/lib/${python.libPrefix}/site-packages/thumbor"
|
|
|
|
substituteInPlace "tests/detectors/test_glasses_detector.py" \
|
|
|
|
--replace "./thumbor" "$out/lib/${python.libPrefix}/site-packages/thumbor"
|
2018-03-15 21:34:10 +00:00
|
|
|
'';
|
|
|
|
|
2018-10-27 14:17:52 +01:00
|
|
|
checkInputs = [
|
|
|
|
nose
|
|
|
|
pyssim
|
|
|
|
preggy
|
|
|
|
mock
|
|
|
|
yanc
|
|
|
|
remotecv
|
|
|
|
raven
|
|
|
|
pkgs.redis
|
|
|
|
pkgs.glibcLocales
|
2019-03-11 22:15:40 +00:00
|
|
|
pkgs.gifsicle
|
2018-10-27 14:17:52 +01:00
|
|
|
];
|
|
|
|
|
2018-03-15 21:34:10 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
tornado
|
|
|
|
pycrypto
|
|
|
|
pycurl
|
|
|
|
pytz
|
|
|
|
pillow
|
|
|
|
derpconf
|
|
|
|
python_magic
|
|
|
|
libthumbor
|
2018-10-27 14:17:52 +01:00
|
|
|
opencv3
|
2018-03-15 21:34:10 +00:00
|
|
|
webcolors
|
|
|
|
piexif
|
|
|
|
statsd
|
2019-03-13 22:38:32 +00:00
|
|
|
cairosvg
|
2018-03-15 21:34:10 +00:00
|
|
|
] ++ lib.optionals (!isPy3k) [ futures thumborPexif ];
|
|
|
|
|
2018-10-27 14:17:52 +01:00
|
|
|
# Remove the source tree before running nosetests because otherwise nosetests
|
|
|
|
# uses that instead of the installed package. Is there some other way to
|
|
|
|
# achieve this?
|
|
|
|
checkPhase = ''
|
|
|
|
redis-server --port 6668 --requirepass hey_you &
|
|
|
|
rm -r thumbor
|
|
|
|
export LC_ALL="en_US.UTF-8"
|
2019-03-11 22:15:40 +00:00
|
|
|
nosetests -v --with-yanc -s tests/ -e test_redeye_applied
|
2018-10-27 14:17:52 +01:00
|
|
|
'';
|
2018-03-15 21:34:10 +00:00
|
|
|
|
2018-08-15 12:54:27 +01:00
|
|
|
meta = with lib; {
|
2018-03-15 21:34:10 +00:00
|
|
|
description = "A smart imaging service";
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://github.com/thumbor/thumbor/wiki";
|
2018-03-15 21:34:10 +00:00
|
|
|
license = licenses.mit;
|
2019-12-26 14:13:48 +00:00
|
|
|
maintainers = with maintainers; [ ];
|
2018-03-15 21:34:10 +00:00
|
|
|
};
|
|
|
|
}
|