Merge pull request #118407 from dotlambda/pyturbojpeg-init
pythonPackages.pyturbojpeg: init at 1.4.1
This commit is contained in:
commit
ba96478bf3
45
pkgs/development/python-modules/pyturbojpeg/default.nix
Normal file
45
pkgs/development/python-modules/pyturbojpeg/default.nix
Normal file
|
@ -0,0 +1,45 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, python
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, substituteAll
|
||||
, libjpeg_turbo
|
||||
, numpy
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pyturbojpeg";
|
||||
version = "1.4.1";
|
||||
|
||||
src = fetchPypi {
|
||||
pname = "PyTurboJPEG";
|
||||
inherit version;
|
||||
sha256 = "09688a93331281e566569b4d313e1d1a058ca32ccae1a2473847a10e4ca2f2a7";
|
||||
};
|
||||
|
||||
patches = [
|
||||
(substituteAll {
|
||||
src = ./lib-path.patch;
|
||||
libturbojpeg = "${libjpeg_turbo.out}/lib/libturbojpeg${stdenv.hostPlatform.extensions.sharedLibrary}";
|
||||
})
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
numpy
|
||||
];
|
||||
|
||||
# upstream has no tests, but we want to test whether the library is found
|
||||
checkPhase = ''
|
||||
${python.interpreter} -c 'from turbojpeg import TurboJPEG; TurboJPEG()'
|
||||
'';
|
||||
|
||||
pythonImportsCheck = [ "turbojpeg" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "A Python wrapper of libjpeg-turbo for decoding and encoding JPEG image";
|
||||
homepage = "https://github.com/lilohuang/PyTurboJPEG";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ dotlambda ];
|
||||
};
|
||||
}
|
28
pkgs/development/python-modules/pyturbojpeg/lib-path.patch
Normal file
28
pkgs/development/python-modules/pyturbojpeg/lib-path.patch
Normal file
|
@ -0,0 +1,28 @@
|
|||
diff --git a/turbojpeg.py b/turbojpeg.py
|
||||
index 73edb38..bfa8c67 100644
|
||||
--- a/turbojpeg.py
|
||||
+++ b/turbojpeg.py
|
||||
@@ -408,22 +408,7 @@ class TurboJPEG(object):
|
||||
|
||||
def __find_turbojpeg(self):
|
||||
"""returns default turbojpeg library path if possible"""
|
||||
- lib_path = find_library('turbojpeg')
|
||||
- if lib_path is not None:
|
||||
- return lib_path
|
||||
- for lib_path in DEFAULT_LIB_PATHS[platform.system()]:
|
||||
- if os.path.exists(lib_path):
|
||||
- return lib_path
|
||||
- if platform.system() == 'Linux' and 'LD_LIBRARY_PATH' in os.environ:
|
||||
- ld_library_path = os.environ['LD_LIBRARY_PATH']
|
||||
- for path in ld_library_path.split(':'):
|
||||
- lib_path = os.path.join(path, 'libturbojpeg.so.0')
|
||||
- if os.path.exists(lib_path):
|
||||
- return lib_path
|
||||
- raise RuntimeError(
|
||||
- 'Unable to locate turbojpeg library automatically. '
|
||||
- 'You may specify the turbojpeg library path manually.\n'
|
||||
- 'e.g. jpeg = TurboJPEG(lib_path)')
|
||||
+ return '@libturbojpeg@'
|
||||
|
||||
def __getaddr(self, nda):
|
||||
"""returns the memory address for a given ndarray"""
|
|
@ -353,7 +353,7 @@
|
|||
"hlk_sw16" = ps: with ps; [ ]; # missing inputs: hlk-sw16
|
||||
"home_connect" = ps: with ps; [ aiohttp-cors ]; # missing inputs: homeconnect
|
||||
"homeassistant" = ps: with ps; [ ];
|
||||
"homekit" = ps: with ps; [ HAP-python pyqrcode aiohttp-cors base36 fnvhash ha-ffmpeg zeroconf ]; # missing inputs: PyTurboJPEG
|
||||
"homekit" = ps: with ps; [ HAP-python pyqrcode pyturbojpeg aiohttp-cors base36 fnvhash ha-ffmpeg zeroconf ];
|
||||
"homekit_controller" = ps: with ps; [ aiohomekit aiohttp-cors zeroconf ];
|
||||
"homematic" = ps: with ps; [ pyhomematic ];
|
||||
"homematicip_cloud" = ps: with ps; [ ]; # missing inputs: homematicip
|
||||
|
|
|
@ -229,6 +229,7 @@ in with py.pkgs; buildPythonApplication rec {
|
|||
"hddtemp"
|
||||
"history"
|
||||
"history_stats"
|
||||
"homekit"
|
||||
"homekit_controller"
|
||||
"homeassistant"
|
||||
"homematic"
|
||||
|
|
|
@ -6915,6 +6915,8 @@ in {
|
|||
|
||||
pytun = callPackage ../development/python-modules/pytun { };
|
||||
|
||||
pyturbojpeg = callPackage ../development/python-modules/pyturbojpeg { };
|
||||
|
||||
pytz = callPackage ../development/python-modules/pytz { };
|
||||
|
||||
pytzdata = callPackage ../development/python-modules/pytzdata { };
|
||||
|
|
Loading…
Reference in a new issue