aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/development/python-modules/ansible-lint/default.nix
blob: 2718ba7670b598c8b4acf282179eadd312aab5f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{ lib
, fetchPypi
, buildPythonPackage
, isPy27
, ansible
, pyyaml
, setuptools_scm
, ruamel_yaml
, rich
, pytestCheckHook
, pytestcov
, pytest_xdist
, git
}:

buildPythonPackage rec {
  pname = "ansible-lint";
  version = "4.3.7";
  # pip is not able to import version info on raumel.yaml
  disabled = isPy27;

  src = fetchPypi {
    inherit pname version;
    sha256 = "0kwwv9dv9rgsqvp15r2vma7hii9lkkqn0n2irvp5h32cbhzzq4hh";
  };

  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" ""
  '';

  # give a hint to setuptools_scm on package version
  preBuild = ''
    export SETUPTOOLS_SCM_PRETEND_VERSION="v${version}"
    export HOME=$(mktemp -d)
  '';

  checkPhase = ''
    pytest -k 'not test_run_playbook_github and not test_run_single_role_path_no_trailing_slash_script'
  '';

  meta = with lib; {
    homepage = "https://github.com/ansible/ansible-lint";
    description = "Best practices checker for Ansible";
    license = licenses.mit;
    maintainers = [ maintainers.sengaya ];
  };
}