2019-12-03 12:30:51 +00:00
#
# spec file for package python-pre-commit
#
2022-01-11 01:38:20 +00:00
# Copyright (c) 2022 SUSE LLC
2019-12-03 12:30:51 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
2019-12-04 07:06:40 +00:00
2019-12-03 12:30:51 +00:00
%define skip_python2 1
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name : python-pre-commit
2022-03-26 19:50:57 +00:00
Version : 2.17.0
2019-12-03 12:30:51 +00:00
Release : 0
Summary : Multi-language pre-commit hooks
License : MIT
URL : https://github.com/pre-commit/pre-commit
Source : https://github.com/pre-commit/pre-commit/archive/v%{version} .tar.gz#/pre_commit-%{version}.tar.gz
BuildRequires : %{python_module setuptools}
BuildRequires : fdupes
2022-03-26 19:50:57 +00:00
BuildRequires : lua54-devel
BuildRequires : lua54-luarocks
2019-12-03 12:30:51 +00:00
BuildRequires : python-rpm-macros
2020-03-18 11:56:14 +00:00
Requires : python-PyYAML >= 5.1
Requires : python-cfgv >= 2.0.0
2019-12-03 12:30:51 +00:00
Requires : python-identify >= 1.0.0
Requires : python-nodeenv >= 0.11.1
2022-01-11 01:38:20 +00:00
Requires : python-re-assert
2019-12-03 12:30:51 +00:00
Requires : python-toml
2020-07-19 05:17:11 +00:00
Requires : python-virtualenv >= 20.0.8
2021-02-16 13:34:57 +00:00
Requires(post) : update-alternatives
2022-01-11 01:38:20 +00:00
Requires(postun) : update-alternatives
2019-12-03 12:30:51 +00:00
BuildArch : noarch
# SECTION test requirements
2020-03-18 11:56:14 +00:00
BuildRequires : %{python_module PyYAML >= 5.1}
BuildRequires : %{python_module cfgv >= 2.0.0}
2019-12-03 12:30:51 +00:00
BuildRequires : %{python_module identify >= 1.0.0}
BuildRequires : %{python_module mock}
BuildRequires : %{python_module nodeenv >= 0.11.1}
2020-03-18 11:56:14 +00:00
BuildRequires : %{python_module pytest-env}
BuildRequires : %{python_module pytest}
2022-01-11 01:38:20 +00:00
BuildRequires : %{python_module re-assert}
2019-12-03 12:30:51 +00:00
BuildRequires : %{python_module toml}
2020-07-19 05:17:11 +00:00
BuildRequires : %{python_module virtualenv >= 20.0.8}
2021-02-16 13:34:57 +00:00
BuildRequires : %{pythons}
2019-12-03 12:30:51 +00:00
BuildRequires : git-core
# /SECTION
%python_subpackages
%description
A framework for managing and maintaining multi-language pre-commit hooks.
%prep
%setup -q -n pre-commit-%{version}
2020-03-18 11:56:14 +00:00
sed -i 's|^#!%{_bindir}/env python|#!%{_bindir}/python|' pre_commit/resources/hook-tmpl
2019-12-03 12:30:51 +00:00
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot} %{$python_sitelib}
2021-02-16 13:34:57 +00:00
%python_clone -a %{buildroot} %{_bindir} /pre-commit
%python_clone -a %{buildroot} %{_bindir} /pre-commit-validate-manifest
%python_clone -a %{buildroot} %{_bindir} /pre-commit-validate-config
2019-12-03 12:30:51 +00:00
2020-03-18 11:56:14 +00:00
%check
export GIT_AUTHOR_NAME=test GIT_COMMITTER_NAME=test \
GIT_AUTHOR_EMAIL=test@example.com GIT_COMMITTER_EMAIL=test@example.com \
2020-07-19 05:17:11 +00:00
VIRTUALENV_NO_DOWNLOAD=1 PRE_COMMIT_NO_CONCURRENCY=1 LANG=en_US.UTF-8
2022-01-11 01:38:20 +00:00
# gh#pre-commit/pre-commit#1202
# test_switch_language_versions_doesnt_clobber - looks like your installation of python is broken?
# test_run_a_ruby_hook, test_additional_ruby_dependencies_installed: you need to have gem installed
# test_golang_hook, test_golang_hook_still_works_when_gobin_is_set, test_additional_golang_dependencies_installed, test_local_golang_additional_dependencies: you need to have go installed
# test_rust_hook, test_additional_rust_lib_dependencies_installed, test_local_rust_additional_dependencies: you need to have cargo installed
# test_installed_from_venv I suspect you have some PYTHONPATH shenanigans going on? hard to tell
# conda, dart, dotnet, node, r tests: not available
# test_node_hook_with_npm_userconfig_set: need internet
# test_perl_hook, test_local_perl_additional_dependencies: need internet
2020-07-19 05:17:11 +00:00
EXCLUDED_TESTS=" t e s t _ m a i n o r t e s t _ r u n _ a _ n o d e _ h o o k o r t e s t _ r u n _ v e r s i o n e d _ n o d e _ h o o k o r t e s t _ a d d i t i o n a l _ n o d e _ d e p e n d e n c i e s _ i n s t a l l e d o r t e s t _ n o d e _ h o o k _ w i t h _ n p m _ u s e r c o n f i g _ s e t "
2020-03-18 11:56:14 +00:00
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ r u n _ v e r s i o n e d _ r u b y _ h o o k o r t e s t _ r u n _ r u b y _ h o o k _ w i t h _ d i s a b l e _ s h a r e d _ g e m s o r t e s t _ a d d i t i o n a l _ d e p e n d e n c i e s _ r o l l _ f o r w a r d "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ g o l a n g o r t e s t _ a d d i t i o n a l _ r u b y _ o r t e s t _ a d d i t i o n a l _ g o l a n g _ o r t e s t _ a d d i t i o n a l _ r u s t _ o r t e s t _ r u s t "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ s w i t c h _ l a n g u a g e _ v e r s i o n s _ d o e s n t _ c l o b b e r o r t e s t _ r u n _ a _ r u b y _ h o o k o r t e s t _ l o c a l _ g o l a n g _ a d d i t i o n a l _ d e p e n d e n c i e s "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ l o c a l _ r u s t _ a d d i t i o n a l _ d e p e n d e n c i e s o r t e s t _ i n s t a l l e d _ f r o m _ v e n v "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r c o n d a o r t e s t _ p e r l _ h o o k o r t e s t _ l o c a l _ p e r l _ a d d i t i o n a l _ d e p e n d e n c i e s "
2022-01-11 01:38:20 +00:00
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r d a r t o r d o t n e t o r r _ o r n o d e o r r u b y "
2022-03-26 19:50:57 +00:00
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ l o c a l _ l u a _ a d d i t i o n a l _ d e p e n d e n c i e s "
2020-03-18 11:56:14 +00:00
git init .
%pytest -k " n o t ( $ E X C L U D E D _ T E S T S ) "
2019-12-03 12:30:51 +00:00
2021-02-16 13:34:57 +00:00
%post
%python_install_alternative pre-commit
%python_install_alternative pre-commit-validate-config
%python_install_alternative pre-commit-validate-manifest
%postun
%python_uninstall_alternative pre-commit
%python_uninstall_alternative pre-commit-validate-config
%python_uninstall_alternative pre-commit-validate-manifest
2019-12-03 12:30:51 +00:00
%files %{python_files}
2021-02-16 13:34:57 +00:00
%python_alternative %{_bindir} /pre-commit-validate-manifest
%python_alternative %{_bindir} /pre-commit
%python_alternative %{_bindir} /pre-commit-validate-config
2020-05-04 05:27:19 +00:00
%{python_sitelib} /pre_commit
%{python_sitelib} /pre_commit-%{version} -py*.egg-info
2019-12-03 12:30:51 +00:00
%changelog