1{ 2 lib, 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 = "0290e98bae9c5480c995954d3f14b4cf0a0395ff"; 22 hash = "sha256-dr3hC6dGd3HNSE4nRj1xrfFSW9cepQ1mdVH8S3YQdtw="; 23 }; 24in 25buildPythonPackage rec { 26 pname = "jpylyzer"; 27 version = "2.2.1"; 28 format = "setuptools"; 29 30 src = fetchFromGitHub { 31 owner = "openpreserve"; 32 repo = "jpylyzer"; 33 rev = version; 34 hash = "sha256-P42qAks8suI/Xknwd8WAkymbGE7RApRa/a11J/V4LA0="; 35 }; 36 37 propagatedBuildInputs = [ six ]; 38 39 nativeCheckInputs = [ 40 pytestCheckHook 41 lxml 42 ]; 43 44 # don't depend on testFiles unless doFullCheck as it may not be extractable 45 # on some filesystems due to weird filenames 46 preCheck = lib.optionalString doFullCheck '' 47 sed -i '/^testFilesDir = /ctestFilesDir = "${testFiles}/files"' tests/unit/test_testfiles.py 48 ''; 49 50 disabledTestPaths = lib.optionals (!doFullCheck) [ "tests/unit/test_testfiles.py" ]; 51 52 pythonImportsCheck = [ "jpylyzer" ]; 53 54 disallowedReferences = [ testFiles ]; 55 56 passthru.tests = { 57 withFullCheck = jpylyzer.override { doFullCheck = true; }; 58 }; 59 60 meta = with lib; { 61 description = "JP2 (JPEG 2000 Part 1) image validator and properties extractor"; 62 mainProgram = "jpylyzer"; 63 homepage = "https://jpylyzer.openpreservation.org/"; 64 license = licenses.lgpl3; 65 maintainers = with maintainers; [ ris ]; 66 }; 67}