nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, fetchPypi
3, buildPythonPackage
4, isPy27
5, ansible
6, pyyaml
7, six
8, nose
9, setuptools_scm
10, ruamel_yaml
11, pathlib2
12}:
13
14buildPythonPackage rec {
15 pname = "ansible-lint";
16 version = "4.2.0";
17 # pip is not able to import version info on raumel.yaml
18 disabled = isPy27;
19
20 src = fetchPypi {
21 inherit pname version;
22 sha256 = "eb925d8682d70563ccb80e2aca7b3edf84fb0b768cea3edc6846aac7abdc414a";
23 };
24
25 format = "pyproject";
26
27 nativeBuildInputs = [ setuptools_scm ];
28 propagatedBuildInputs = [ pyyaml six ansible ruamel_yaml ]
29 ++ lib.optionals isPy27 [ pathlib2 ];
30 checkInputs = [ nose ];
31
32 postPatch = ''
33 patchShebangs bin/ansible-lint
34 substituteInPlace setup.cfg \
35 --replace "setuptools_scm_git_archive>=1.0" ""
36 '';
37
38 # give a hint to setuptools_scm on package version
39 preBuild = ''
40 export SETUPTOOLS_SCM_PRETEND_VERSION="v${version}"
41 export HOME=$(mktemp -d)
42 '';
43
44 checkPhase = ''
45 PATH=$out/bin:$PATH nosetests test
46 '';
47
48 meta = with lib; {
49 homepage = "https://github.com/willthames/ansible-lint";
50 description = "Best practices checker for Ansible";
51 license = licenses.mit;
52 maintainers = [ maintainers.sengaya ];
53 };
54}