1{ lib 2, stdenv 3, fetchFromGitHub 4, buildPythonPackage 5, six 6, lxml 7, pytestCheckHook 8, doFullCheck ? false # weird filenames cause issues on some filesystems 9 10# for passthru.tests 11, jpylyzer 12}: 13 14let 15 # unclear relationship between test-files version and jpylyzer version. 16 # upstream appears to just always test against the latest version, so 17 # probably worth updating this when package is bumped. 18 testFiles = fetchFromGitHub { 19 owner = "openpreserve"; 20 repo = "jpylyzer-test-files"; 21 rev = "146cb0029b5ea9d8ef22dc6683cec8afae1cc63a"; 22 hash = "sha256-uKUau7mYXqGs4dSnXGPnPsH9k81ZCK0aPj5F9HWBMZ8="; 23 }; 24 25in buildPythonPackage rec { 26 pname = "jpylyzer"; 27 version = "2.1.0"; 28 29 src = fetchFromGitHub { 30 owner = "openpreserve"; 31 repo = pname; 32 rev = version; 33 hash = "sha256-LBVOwjWC/HEvGgoi8WxEdl33M4JrfdHEj1Dk7f1NAiA="; 34 }; 35 36 propagatedBuildInputs = [ six ]; 37 38 nativeCheckInputs = [ pytestCheckHook lxml ]; 39 40 # don't depend on testFiles unless doFullCheck as it may not be extractable 41 # on some filesystems due to weird filenames 42 preCheck = lib.optionalString doFullCheck '' 43 sed -i '/^testFilesDir = /ctestFilesDir = "${testFiles}"' tests/unit/test_testfiles.py 44 ''; 45 disabledTestPaths = lib.optionals (!doFullCheck) [ 46 "tests/unit/test_testfiles.py" 47 ]; 48 49 pythonImportsCheck = [ "jpylyzer" ]; 50 51 disallowedReferences = [ testFiles ]; 52 53 passthru.tests = { 54 withFullCheck = jpylyzer.override { doFullCheck = true; }; 55 }; 56 57 meta = with lib; { 58 description = "JP2 (JPEG 2000 Part 1) image validator and properties extractor"; 59 homepage = "https://jpylyzer.openpreservation.org/"; 60 license = licenses.lgpl3; 61 maintainers = with maintainers; [ ris ]; 62 }; 63}