1{
2 lib,
3 ansible-compat,
4 ansible-core,
5 buildPythonPackage,
6 click-help-colors,
7 enrich,
8 fetchPypi,
9 jsonschema,
10 molecule,
11 packaging,
12 pluggy,
13 pythonOlder,
14 rich,
15 setuptools,
16 setuptools-scm,
17 testers,
18 wcmatch,
19 withPlugins ? true,
20 molecule-plugins,
21 yamllint,
22}:
23
24buildPythonPackage rec {
25 pname = "molecule";
26 version = "25.9.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.10";
30
31 src = fetchPypi {
32 inherit pname version;
33 hash = "sha256-GlbSg7H7VIhDnqyUWXHb1mt3LtQ7LGandpIsuT05+/0=";
34 };
35
36 nativeBuildInputs = [
37 setuptools
38 setuptools-scm
39 ];
40
41 propagatedBuildInputs = [
42 ansible-compat
43 ansible-core
44 click-help-colors
45 enrich
46 jsonschema
47 packaging
48 pluggy
49 rich
50 yamllint
51 wcmatch
52 ]
53 ++ lib.optional withPlugins molecule-plugins;
54
55 pythonImportsCheck = [ "molecule" ];
56
57 # tests can't be easily run without installing things from ansible-galaxy
58 doCheck = false;
59
60 passthru.tests.version =
61 (testers.testVersion {
62 package = molecule;
63 command = "PY_COLORS=0 ${pname} --version";
64 }).overrideAttrs
65 (old: {
66 # workaround the error: Permission denied: '/homeless-shelter'
67 HOME = "$(mktemp -d)";
68 });
69
70 meta = with lib; {
71 description = "Aids in the development and testing of Ansible roles";
72 homepage = "https://github.com/ansible-community/molecule";
73 changelog = "https://github.com/ansible/molecule/releases/tag/v${version}";
74 license = licenses.mit;
75 maintainers = with maintainers; [ dawidd6 ];
76 mainProgram = "molecule";
77 };
78}