Merge pull request #115349 from SuperSandro2000/ansible-lint

This commit is contained in:
Sandro 2021-03-12 21:37:02 +01:00 committed by GitHub
commit 7eab1a2d2e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 139 additions and 27 deletions

View File

@ -4,52 +4,71 @@
, isPy27
, ansible
, pyyaml
, setuptools_scm
, ruamel_yaml
, ruamel-yaml
, rich
, pytestCheckHook
, pytestcov
, pytest_xdist
, pytest-xdist
, git
, wcmatch
, enrich
, python
}:
buildPythonPackage rec {
pname = "ansible-lint";
version = "4.3.7";
# pip is not able to import version info on raumel.yaml
version = "5.0.2";
disabled = isPy27;
format = "pyproject";
src = fetchPypi {
inherit pname version;
sha256 = "0kwwv9dv9rgsqvp15r2vma7hii9lkkqn0n2irvp5h32cbhzzq4hh";
sha256 = "sha256-vgt/KqNozTPaON/I19SybBZuo7bbl3Duq5dTBTMlj44=";
};
format = "pyproject";
nativeBuildInputs = [ setuptools_scm ];
propagatedBuildInputs = [ pyyaml ansible ruamel_yaml rich ];
checkInputs = [ pytestCheckHook pytestcov pytest_xdist git ];
postPatch = ''
patchShebangs bin/ansible-lint
substituteInPlace setup.cfg \
--replace "setuptools_scm_git_archive>=1.0" ""
substituteInPlace src/ansiblelint/file_utils.py \
--replace 'raise RuntimeError("Unable to determine file type for %s" % pathex)' 'return "playbook"'
'';
# give a hint to setuptools_scm on package version
preBuild = ''
export SETUPTOOLS_SCM_PRETEND_VERSION="v${version}"
buildInputs = [ python ];
propagatedBuildInputs = [ ansible enrich pyyaml rich ruamel-yaml wcmatch ];
checkInputs = [ pytestCheckHook pytest-xdist git ];
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
patchShebangs src/ansiblelint/__main__.py
'';
checkPhase = ''
pytest -W ignore::DeprecationWarning -k 'not test_run_playbook_github and not test_run_single_role_path_no_trailing_slash_script'
'';
disabledTests = [
# requires network
"test_prerun_reqs_v1"
"test_prerun_reqs_v2"
# Assertion error with negative numbers; maybe requieres an ansible update?
"test_negative"
"test_example"
"test_playbook"
"test_included_tasks"
"test_long_line"
"test_get_yaml_files_umlaut"
"test_run_inside_role_dir"
"test_role_handler_positive"
];
makeWrapperArgs = [ "--prefix PATH : ${lib.makeBinPath [ ansible ]}" ];
meta = with lib; {
homepage = "https://github.com/ansible/ansible-lint";
homepage = "https://github.com/ansible-community/ansible-lint";
description = "Best practices checker for Ansible";
license = licenses.mit;
maintainers = [ maintainers.sengaya ];
maintainers = with maintainers; [ sengaya SuperSandro2000 ];
};
}

View File

@ -0,0 +1,22 @@
{ lib, buildPythonPackage, fetchPypi, pytestCheckHook }:
buildPythonPackage rec {
pname = "bracex";
version = "2.1.1";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-AfcVzQ7XpiLsizIyLnFYE/dXTeUx8Jtw9vOywQ9oJCU=";
};
checkInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "bracex" ];
meta = with lib; {
description = "Bash style brace expansion for Python";
homepage = "https://github.com/facelessuser/bracex";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -0,0 +1,26 @@
{ lib, buildPythonPackage, fetchPypi, pytestCheckHook, setuptools-scm, rich, pytest-mock }:
buildPythonPackage rec {
pname = "enrich";
version = "1.2.6";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-Dpn/V9h/e13vDKeZF+iPuTUaoNUuIo7ji/982FgxX+Q=";
};
buildInputs = [ setuptools-scm ];
propagatedBuildInputs = [ rich ];
checkInputs = [ pytestCheckHook pytest-mock ];
pythonImportsCheck = [ "enrich" ];
meta = with lib; {
description = "Enrich adds few missing features to the wonderful rich library";
homepage = "https://github.com/pycontribs/enrich";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -1,4 +1,4 @@
{ lib, buildPythonPackage, fetchPypi, pip, pytest }:
{ lib, buildPythonPackage, fetchPypi, toml }:
buildPythonPackage rec {
pname = "setuptools_scm";
@ -9,13 +9,16 @@ buildPythonPackage rec {
sha256 = "a8994582e716ec690f33fec70cca0f85bd23ec974e3f783233e4879090a7faa8";
};
propagatedBuildInputs = [ toml ];
# Requires pytest, circular dependency
doCheck = false;
pythonImportsCheck = [ "setuptools_scm" ];
meta = with lib; {
homepage = "https://bitbucket.org/pypa/setuptools_scm/";
homepage = "https://github.com/pypa/setuptools_scm/";
description = "Handles managing your python package versions in scm metadata";
license = licenses.mit;
maintainers = with maintainers; [ ];
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -0,0 +1,32 @@
{ lib, buildPythonPackage, fetchPypi, pytestCheckHook, bracex }:
buildPythonPackage rec {
pname = "wcmatch";
version = "8.1.1";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-e6CRkflYLoLYZIKb37qwLfRuJqRqME5Xx/5WUvB/KXo=";
};
propagatedBuildInputs = [ bracex ];
checkInputs = [ pytestCheckHook ];
preCheck = ''
export HOME=$(mktemp -d)
'';
disabledTests = [
"TestTilde"
];
pythonImportsCheck = [ "wcmatch" ];
meta = with lib; {
description = "Wilcard File Name matching library";
homepage = "https://github.com/facelessuser/wcmatch";
license = licenses.mit;
maintainers = with maintainers; [ SuperSandro2000 ];
};
}

View File

@ -1068,6 +1068,8 @@ in {
bpython = callPackage ../development/python-modules/bpython { };
bracex = callPackage ../development/python-modules/bracex { };
braintree = callPackage ../development/python-modules/braintree { };
branca = callPackage ../development/python-modules/branca { };
@ -2111,6 +2113,8 @@ in {
enamlx = callPackage ../development/python-modules/enamlx { };
enrich = callPackage ../development/python-modules/enrich { };
entrance = callPackage ../development/python-modules/entrance {
routerFeatures = false;
};
@ -7124,12 +7128,16 @@ in {
rtslib = callPackage ../development/python-modules/rtslib { };
ruamel-base = self.ruamel_base;
ruamel_base = callPackage ../development/python-modules/ruamel_base { };
ruamel-ordereddict = self.ruamel_ordereddict;
ruamel_ordereddict = callPackage ../development/python-modules/ruamel_ordereddict { };
ruamel-yaml = self.ruamel_yaml;
ruamel_yaml = callPackage ../development/python-modules/ruamel_yaml { };
ruamel-yaml-clib = self.ruamel_yaml_clib;
ruamel_yaml_clib = callPackage ../development/python-modules/ruamel_yaml_clib { };
rubymarshal = callPackage ../development/python-modules/rubymarshal { };
@ -8490,6 +8498,8 @@ in {
WazeRouteCalculator = callPackage ../development/python-modules/WazeRouteCalculator { };
wcmatch = callPackage ../development/python-modules/wcmatch { };
wcwidth = callPackage ../development/python-modules/wcwidth { };
weasyprint = callPackage ../development/python-modules/weasyprint { };