| 1 |
# spell-checker:ignore bcond pkgversion buildrequires autosetup PYTHONPATH noarch buildroot bindir sitelib numprocesses clib |
| 2 |
# All tests require Internet access |
| 3 |
# to test in mock use: --enable-network --with check |
| 4 |
# to test in a privileged environment use: |
| 5 |
# --with check --with privileged_tests |
| 6 |
%bcond_with check |
| 7 |
%bcond_with privileged_tests |
| 8 |
|
| 9 |
Name: ansible-lint |
| 10 |
Version: VERSION_PLACEHOLDER |
| 11 |
Release: 1%{?dist} |
| 12 |
Summary: Ansible-lint checks ansible content for common mistakes |
| 13 |
|
| 14 |
License: GPL-3.0-or-later AND MIT |
| 15 |
URL: https://github.com/ansible/ansible-lint |
| 16 |
Source0: %{pypi_source} |
| 17 |
|
| 18 |
BuildArch: noarch |
| 19 |
|
| 20 |
BuildRequires: python%{python3_pkgversion}-devel |
| 21 |
%if %{with check} |
| 22 |
# These are required for tests: |
| 23 |
BuildRequires: python%{python3_pkgversion}-pytest |
| 24 |
BuildRequires: python%{python3_pkgversion}-pytest-xdist |
| 25 |
BuildRequires: python%{python3_pkgversion}-libselinux |
| 26 |
BuildRequires: git-core |
| 27 |
%endif |
| 28 |
Requires: git-core |
| 29 |
|
| 30 |
|
| 31 |
%description |
| 32 |
Ansible-lint checks ansible content for practices and behaviors that could |
| 33 |
potentially be improved. |
| 34 |
|
| 35 |
%prep |
| 36 |
%autosetup |
| 37 |
|
| 38 |
|
| 39 |
%generate_buildrequires |
| 40 |
%pyproject_buildrequires |
| 41 |
|
| 42 |
|
| 43 |
%build |
| 44 |
%pyproject_wheel |
| 45 |
|
| 46 |
|
| 47 |
%install |
| 48 |
%pyproject_install |
| 49 |
%pyproject_save_files ansiblelint |
| 50 |
|
| 51 |
|
| 52 |
%check |
| 53 |
# Don't try to import tests that import pytest which isn't available at runtime |
| 54 |
%pyproject_check_import -e 'ansiblelint.testing*' -e 'ansiblelint.rules.conftest' |
| 55 |
%if %{with check} |
| 56 |
%pytest \ |
| 57 |
-v \ |
| 58 |
--disable-pytest-warnings \ |
| 59 |
--numprocesses=auto \ |
| 60 |
%if %{with privileged_tests} |
| 61 |
tests |
| 62 |
%else |
| 63 |
tests/unit |
| 64 |
%endif |
| 65 |
%endif |
| 66 |
|
| 67 |
|
| 68 |
%files -f %{pyproject_files} |
| 69 |
%{_bindir}/ansible-lint |
| 70 |
%license COPYING docs/licenses/LICENSE.mit.txt |
| 71 |
%doc docs/ README.md |
| 72 |
|
| 73 |
%changelog |