ansible-lint: 24.12.2 -> 25.2.1 (#398705)

This commit is contained in:
Arne Keller
2025-04-18 15:19:20 +02:00
committed by GitHub
2 changed files with 35 additions and 32 deletions
+25 -24
View File
@@ -1,37 +1,34 @@
{
lib,
python3,
python3Packages,
fetchPypi,
ansible,
writableTmpDirAsHomeHook,
}:
python3.pkgs.buildPythonApplication rec {
python3Packages.buildPythonApplication rec {
pname = "ansible-lint";
version = "24.12.2";
format = "pyproject";
version = "25.2.1";
pyproject = true;
src = fetchPypi {
inherit version;
pname = "ansible_lint";
hash = "sha256-9jYwnE5/ck/BpUTfUpxMI1T1TPNe3hHXUDZq+xFYpGQ=";
hash = "sha256-7Esfz6i+8T9Uf+76IupoZN79kCs6Jn749MU0GXb0X/E=";
};
postPatch = ''
# it is fine if lint tools are missing
substituteInPlace conftest.py \
--replace "sys.exit(1)" ""
--replace-fail "sys.exit(1)" ""
'';
nativeBuildInputs = with python3.pkgs; [
build-system = with python3Packages; [
setuptools
setuptools-scm
];
pythonRelaxDeps = [
"ruamel.yaml"
];
propagatedBuildInputs = with python3.pkgs; [
dependencies = with python3Packages; [
# https://github.com/ansible/ansible-lint/blob/master/.config/requirements.in
ansible-core
ansible-compat
@@ -48,20 +45,24 @@ python3.pkgs.buildPythonApplication rec {
yamllint
];
pythonRelaxDeps = [ "ruamel.yaml" ];
# tests can't be easily run without installing things from ansible-galaxy
doCheck = false;
nativeCheckInputs = with python3.pkgs; [
flaky
pytest-xdist
pytestCheckHook
];
nativeCheckInputs =
with python3Packages;
[
flaky
pytest-xdist
pytestCheckHook
]
++ [
writableTmpDirAsHomeHook
ansible
];
preCheck = ''
# ansible wants to write to $HOME and crashes if it can't
export HOME=$(mktemp -d)
export PATH=$PATH:${lib.makeBinPath [ ansible ]}
# create a working ansible-lint executable
export PATH=$PATH:$PWD/src/ansiblelint
ln -rs src/ansiblelint/__main__.py src/ansiblelint/ansible-lint
@@ -88,12 +89,12 @@ python3.pkgs.buildPythonApplication rec {
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible ]}" ];
meta = with lib; {
meta = {
description = "Best practices checker for Ansible";
mainProgram = "ansible-lint";
homepage = "https://github.com/ansible/ansible-lint";
changelog = "https://github.com/ansible/ansible-lint/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ sengaya ];
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ sengaya ];
};
}
@@ -18,18 +18,19 @@
pytest-mock,
pytest-instafail,
pytestCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
pname = "ansible-compat";
version = "25.1.2";
version = "25.1.5";
pyproject = true;
src = fetchFromGitHub {
owner = "ansible";
repo = "ansible-compat";
tag = "v${version}";
hash = "sha256-AElonUB2zXB3ZcRTwuaYpEQJYHtPw2lD3tBNMEqwuKo=";
hash = "sha256-fc+PXw9sT+CQFwcajuJC1IcAECbNiklzVTGFsZWUJGY=";
};
build-system = [
@@ -42,20 +43,20 @@ buildPythonPackage rec {
subprocess-tee
];
preCheck = ''
export HOME=$(mktemp -d)
substituteInPlace test/test_runtime.py \
--replace-fail "printenv" "${lib.getExe' coreutils "printenv"}"
'';
nativeCheckInputs = [
ansible-core
flaky
pytest-mock
pytest-instafail
pytestCheckHook
writableTmpDirAsHomeHook
];
preCheck = ''
substituteInPlace test/test_runtime.py \
--replace-fail "printenv" "${lib.getExe' coreutils "printenv"}"
'';
disabledTests = [
# require network
"test_install_collection"
@@ -74,6 +75,7 @@ buildPythonPackage rec {
"test_runtime_example"
"test_scan_sys_path"
"test_upgrade_collection"
"test_ro_venv"
];
pythonImportsCheck = [ "ansible_compat" ];