mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-11-27 00:10:12 +00:00
#586402 dropped the Python 3.14 skip of test_custom_param_help, so python314Packages.clize has failed since with NameError: name 'a' is not defined. The test builds its function with sigtools' f() and passes the annotation's name via locals=, which the lazily evaluated annotations on 3.14 cannot see. Pass it via globals= instead, which works on all supported versions and keeps the test running. Assisted-by: Claude Code (Claude Opus 5.5)
71 lines
1.6 KiB
Nix
71 lines
1.6 KiB
Nix
{
|
|
lib,
|
|
attrs,
|
|
buildPythonPackage,
|
|
docutils,
|
|
fetchPypi,
|
|
od,
|
|
pygments,
|
|
python-dateutil,
|
|
repeated-test,
|
|
setuptools-scm,
|
|
sigtools,
|
|
unittestCheckHook,
|
|
}:
|
|
buildPythonPackage (finalAttrs: {
|
|
pname = "clize";
|
|
version = "5.0.2";
|
|
pyproject = true;
|
|
|
|
src = fetchPypi {
|
|
inherit (finalAttrs) pname version;
|
|
hash = "sha256-BH9aRHNgJxirG4VnKn4VMDOHF41agcJ13EKd+sHstRA=";
|
|
};
|
|
|
|
build-system = [ setuptools-scm ];
|
|
|
|
dependencies = [
|
|
attrs
|
|
docutils
|
|
od
|
|
sigtools
|
|
];
|
|
|
|
optional-dependencies = {
|
|
datetime = [ python-dateutil ];
|
|
};
|
|
|
|
postPatch = ''
|
|
# the simulated old docutils only ignores the 0.21 wording of these deprecation warnings
|
|
substituteInPlace clize/tests/test_help.py \
|
|
--replace-fail '"message": r".*Option.*\b0\.21\b.*"' '"message": r"The frontend\.Option(Parser)? class .*"'
|
|
|
|
# annotations are evaluated lazily on Python 3.14 and cannot see the locals passed to f()
|
|
substituteInPlace clize/tests/test_help.py \
|
|
--replace-fail "locals={'a': parser.use_class(named=CustParam, name=\"cust\")})" \
|
|
"globals={'a': parser.use_class(named=CustParam, name=\"cust\")})"
|
|
'';
|
|
|
|
nativeCheckInputs = [
|
|
pygments
|
|
unittestCheckHook
|
|
python-dateutil
|
|
repeated-test
|
|
];
|
|
|
|
unittestFlags = [
|
|
"-s"
|
|
"clize/tests"
|
|
];
|
|
|
|
pythonImportsCheck = [ "clize" ];
|
|
|
|
meta = {
|
|
description = "Command-line argument parsing for Python";
|
|
homepage = "https://github.com/epsy/clize";
|
|
changelog = "https://github.com/epsy/clize/releases/tag/v${finalAttrs.version}";
|
|
license = lib.licenses.mit;
|
|
maintainers = [ ];
|
|
};
|
|
})
|