Yueh-Shun Li 76e2a397c2 treewide: pytestFlagsArray -> pytestFlags and join flag and option argument
This treewide change targets Python packages
that specifies pytest flags with pytestFlagsArray,
and whose flags cannot be consructed by other pytestCheckHook-honoured arguments.

Use the __structuredAttrs-agnostic argument pytestFlags
instead of the deprecated pytestFlagsArray.

For flags with option arguments,
join each flag and their option argument into a single command-line argument
following POSIX Utility Argument Syntax[1]
for easier overriding (remove/replace).

Examples:

* [ "-W" "ignore:message:WarningClass" ] ->
  [ "-Wignore:message:WarningClass" ]

* [ "--reruns" "3" ] ->
  [ "--reruns=3" ]

[1]: https://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap12.html
2025-06-16 01:02:16 +08:00

72 lines
1.4 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
pytestCheckHook,
easyprocess,
entrypoint2,
patool,
cabextract,
}:
buildPythonPackage rec {
pname = "pyunpack";
version = "0.3";
pyproject = true;
src = fetchFromGitHub {
owner = "ponty";
repo = "pyunpack";
tag = version;
hash = "sha256-1MAdiX6+u35f6S8a0ZcIIebZE8bbxTy+0TnMohJ7J6s=";
};
postPatch = ''
substituteInPlace pyunpack/__init__.py \
--replace-fail \
'_exepath("patool")' \
'"${lib.getBin patool}/bin/.patool-wrapped"'
'';
nativeBuildInputs = [ setuptools ];
dependencies = [
easyprocess
entrypoint2
];
nativeCheckInputs = [
pytestCheckHook
cabextract
];
pytestFlags = [ "-x" ];
pythonImportsCheck = [ "pyunpack" ];
disabledTests = [
# pinning test of `--help` sensitive to python version
"test_help"
];
disabledTestPaths = [
# unfree
"tests/test_rar.py"
# We get "patool: error: unrecognized arguments: --password 123"
# The currently packaged version of patool does not support this flag.
# https://github.com/wummel/patool/issues/114
# FIXME: Re-enable these once patool is updated
"tests/test_rarpw.py"
"tests/test_zippw.py"
];
meta = with lib; {
description = "Unpack archive files in python";
homepage = "https://github.com/ponty/pyunpack";
license = licenses.bsd2;
maintainers = with maintainers; [ pbsds ];
};
}