2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2022-12-17 10:02:37 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, buildPythonPackage
|
|
|
|
, six
|
2022-12-17 10:02:37 +00:00
|
|
|
, lxml
|
2021-04-26 19:14:03 +00:00
|
|
|
, pytestCheckHook
|
2023-02-02 18:25:31 +00:00
|
|
|
, doFullCheck ? false # weird filenames cause issues on some filesystems
|
|
|
|
|
|
|
|
# for passthru.tests
|
|
|
|
, jpylyzer
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
let
|
|
|
|
# unclear relationship between test-files version and jpylyzer version.
|
|
|
|
# upstream appears to just always test against the latest version, so
|
|
|
|
# probably worth updating this when package is bumped.
|
|
|
|
testFiles = fetchFromGitHub {
|
|
|
|
owner = "openpreserve";
|
|
|
|
repo = "jpylyzer-test-files";
|
|
|
|
rev = "146cb0029b5ea9d8ef22dc6683cec8afae1cc63a";
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-uKUau7mYXqGs4dSnXGPnPsH9k81ZCK0aPj5F9HWBMZ8=";
|
2022-12-17 10:02:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
in buildPythonPackage rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "jpylyzer";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "2.1.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "openpreserve";
|
|
|
|
repo = pname;
|
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-LBVOwjWC/HEvGgoi8WxEdl33M4JrfdHEj1Dk7f1NAiA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ six ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook lxml ];
|
2022-12-17 10:02:37 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
# don't depend on testFiles unless doFullCheck as it may not be extractable
|
|
|
|
# on some filesystems due to weird filenames
|
|
|
|
preCheck = lib.optionalString doFullCheck ''
|
2022-12-17 10:02:37 +00:00
|
|
|
sed -i '/^testFilesDir = /ctestFilesDir = "${testFiles}"' tests/unit/test_testfiles.py
|
|
|
|
'';
|
2023-02-02 18:25:31 +00:00
|
|
|
disabledTestPaths = lib.optionals (!doFullCheck) [
|
2022-12-17 10:02:37 +00:00
|
|
|
"tests/unit/test_testfiles.py"
|
|
|
|
];
|
|
|
|
|
2021-04-26 19:14:03 +00:00
|
|
|
pythonImportsCheck = [ "jpylyzer" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disallowedReferences = [ testFiles ];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
passthru.tests = {
|
|
|
|
withFullCheck = jpylyzer.override { doFullCheck = true; };
|
|
|
|
};
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "JP2 (JPEG 2000 Part 1) image validator and properties extractor";
|
|
|
|
homepage = "https://jpylyzer.openpreservation.org/";
|
|
|
|
license = licenses.lgpl3;
|
|
|
|
maintainers = with maintainers; [ ris ];
|
|
|
|
};
|
|
|
|
}
|