2018-03-09 10:19:33 +01:00
|
|
|
{ stdenv, fetchPypi, buildPythonPackage
|
|
|
|
, libmediainfo
|
|
|
|
, setuptools_scm
|
|
|
|
, pytest, glibcLocales }:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "pymediainfo";
|
2019-02-14 08:37:26 +01:00
|
|
|
version = "3.0";
|
2018-03-09 10:19:33 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2019-02-14 08:37:26 +01:00
|
|
|
sha256 = "e76cc5525c3fc5cba61073e12365dc06f303b261d8f923aaa6eac09bf8fab245";
|
2018-03-09 10:19:33 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pymediainfo/__init__.py \
|
|
|
|
--replace 'CDLL(library_file)' \
|
|
|
|
'CDLL("${libmediainfo}/lib/libmediainfo${stdenv.hostPlatform.extensions.sharedLibrary}")' \
|
|
|
|
--replace 'CDLL("libmediainfo.0.dylib")' \
|
|
|
|
'CDLL("${libmediainfo}/lib/libmediainfo.0${stdenv.hostPlatform.extensions.sharedLibrary}")' \
|
|
|
|
--replace 'CDLL("libmediainfo.dylib")' \
|
|
|
|
'CDLL("${libmediainfo}/lib/libmediainfo${stdenv.hostPlatform.extensions.sharedLibrary}")' \
|
|
|
|
--replace 'CDLL("libmediainfo.so.0")' \
|
|
|
|
'CDLL("${libmediainfo}/lib/libmediainfo${stdenv.hostPlatform.extensions.sharedLibrary}.0")'
|
2018-10-15 13:44:16 +02:00
|
|
|
|
|
|
|
# Fix test, remove after version 2.3.0
|
|
|
|
substituteInPlace tests/test_pymediainfo.py \
|
|
|
|
--replace 'codec, "AVC"' 'format, "AVC"' \
|
|
|
|
--replace 'codec, "AAC LC"' 'format, "AAC"'
|
2018-03-09 10:19:33 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
nativeBuildInputs = [ setuptools_scm ];
|
|
|
|
|
|
|
|
checkInputs = [ glibcLocales pytest ];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
export LC_ALL=en_US.UTF-8
|
|
|
|
py.test -k 'not test_parse_url' tests
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Python wrapper for the mediainfo library";
|
|
|
|
homepage = https://github.com/sbraz/pymediainfo;
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ jfrankenau ];
|
|
|
|
};
|
|
|
|
}
|