%bcond_without check %bcond_without doc %global forgeurl https://github.com/sqlfluff/sqlfluff %global tag 3.0.4 Version: %{tag} %forgemeta Name: sqlfluff Release: %autorelease Summary: Modular SQL linter and auto-formatter License: MIT URL: %{forgeurl} Source: %{forgesource} BuildArch: noarch BuildRequires: python3-devel # Test dependencies: BuildRequires: python3dist(hypothesis) BuildRequires: python3dist(pytest) BuildRequires: python3dist(pytest-xdist) %if %{with doc} BuildRequires: python3dist(pygments) BuildRequires: python3dist(sphinx) BuildRequires: python3dist(sphinx-click) BuildRequires: python3dist(sphinx-reredirects) %endif %py_provides python3-%{name} %description SQLFluff is a dialect-flexible and configurable SQL linter. Designed with ELT applications in mind, SQLFluff also works with Jinja templating and dbt. SQLFluff will auto-fix most linting errors, allowing you to focus your time on what matters. %if %{with doc} %package doc Summary: Documentation for sqlfluff %description doc The sqlfluff-doc package contains HTML documentation for sqlfluff. %endif %prep %forgeautosetup -p1 %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel # Build sqlfluff-plugin-example, needed for tests. pushd plugins/sqlfluff-plugin-example >/dev/null %py3_build popd >/dev/null %if %{with doc} pushd docs >/dev/null PYTHONPATH="../:../build/lib" %{python3} generate-rule-docs.py PYTHONPATH="../:../build/lib" sphinx-build source html # remove the sphinx-build leftovers rm -r html/.{doctrees,buildinfo} popd >/dev/null %endif %install %pyproject_install %pyproject_save_files -l %{name} %if %{with check} %check PYTHONPATH="%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}:%{_builddir}/%{buildsubdir}/plugins/sqlfluff-plugin-example/src" %pytest %endif %files -f %{pyproject_files} %doc README.md CHANGELOG.md %{_bindir}/%{name} %if %{with doc} %files doc %doc docs/html %endif %changelog %autochangelog