%bcond_without tests %global pypi_name pre-commit %global _pypi_name pre_commit %global _description %{expand: Git hook scripts are useful for identifying simple issues before submission to code review. We run our hooks on every commit to automatically point out issues in code such as missing semicolons, trailing white-space, and debug statements. By pointing these issues out before code review, this allows a code reviewer to focus on the architecture of a change while not wasting time with trivial style nitpicks. pre-commit is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and pre-commit manages the installation and execution of any hook written in any language before every commit. pre-commit is specifically designed to not require root access. If one of your developers does not have node installed but modifies a JavaScript file, pre-commit automatically handles downloading and building node to run `eslint` without root.} Name: %{pypi_name} Version: 1.20.0 Release: 1%{?dist} Summary: Framework for managing and maintaining multi-language pre-commit hooks License: MIT URL: https://pre-commit.com/ Source0: https://github.com/pre-commit/%{pypi_name}/archive/%{version}/%{pypi_name}-%{version}.tar.gz Patch0: 0001-Use-echo-instead-of-python-in-parse_shebang_test.patch Patch1: 0002-Create-an-actual-environment-for-python-healthy-type.patch BuildRequires: git-core BuildRequires: python3-devel BuildRequires: %{py3_dist mock} BuildRequires: %{py3_dist coverage} %if %{with tests} BuildRequires: %{py3_dist virtualenv} BuildRequires: %{py3_dist identify} BuildRequires: %{py3_dist pytest} BuildRequires: %{py3_dist aspy.yaml} BuildRequires: %{py3_dist cfgv} BuildRequires: %{py3_dist toml} %endif BuildArch: noarch %description %_description Summary: %{summary} %{?python_provide:%python_provide %{pypi_name}} %prep %autosetup -S git -p1 -n %{pypi_name}-%{version} rm -rf %{pypi_name}.egg-info find . -type f -name "*.py" -exec sed -i '/^#![ ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';' %build %py3_build %install %py3_install %check %if %{with tests} # Need a git repository to run the tests git init git config --global user.email "example@example.com" git config --global user.name "John Doe" export PYTHONPATH=%{buildroot}%{python3_sitelib} # make_archives_test and repository_test need a network connection, hence disabled. # install_uninstall_test needs pytest-env (currently not packaged) pytest-%{python3_version} --deselect tests/make_archives_test.py --deselect tests/repository_test.py --deselect tests/commands/install_uninstall_test.py %endif %files -n %{pypi_name} %doc README.md %license LICENSE %{python3_sitelib}/%{_pypi_name} %{python3_sitelib}/%{_pypi_name}-%{version}-py%{python3_version}.egg-info %{_bindir}/%{pypi_name} %{_bindir}/%{pypi_name}-validate-config %{_bindir}/%{pypi_name}-validate-manifest %changelog * Sat Dec 7 2019 Aniket Pradhan - 1.20.0-1 - Initial build