2019-12-03 12:30:51 +00:00
#
# spec file for package python-pre-commit
#
2024-01-03 18:40:02 +00:00
# Copyright (c) 2024 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
2023-11-28 09:40:37 +00:00
%{?sle15_python_module_pythons}
2019-12-03 12:30:51 +00:00
Name : python-pre-commit
2024-10-24 19:24:11 +00:00
Version : 4.0.1
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
2023-11-01 15:48:46 +00:00
Source : https://github.com/pre-commit/pre-commit/archive/v%{version} .tar.gz#/pre-commit-%{version}.tar.gz
2024-01-03 18:40:02 +00:00
%if 0%{?sle_version} <= 150600
Group : Development/Tools/Other
%endif
2024-02-28 12:57:18 +00:00
BuildRequires : %{python_module base >= 3.9}
BuildRequires : %{python_module pip}
2019-12-03 12:30:51 +00:00
BuildRequires : %{python_module setuptools}
2024-02-28 12:57:18 +00:00
BuildRequires : %{python_module wheel}
2019-12-03 12:30:51 +00:00
BuildRequires : fdupes
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
2023-11-01 15:48:46 +00:00
Requires : python-virtualenv >= 20.10.0
2021-02-16 13:34:57 +00:00
Requires(post) : update-alternatives
2024-02-28 12:57:18 +00:00
Requires(postun) : update-alternatives
2019-12-03 12:30:51 +00:00
BuildArch : noarch
2023-11-28 09:40:37 +00:00
%if 0%{?sle_version} <= 150600 && 0%{?is_opensuse}
BuildRequires : lua53-devel
BuildRequires : lua53-luarocks
%else
BuildRequires : lua54-devel
BuildRequires : lua54-luarocks
%endif
2019-12-03 12:30:51 +00:00
# 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 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}
2023-11-01 15:48:46 +00:00
BuildRequires : %{python_module virtualenv >= 20.10.0}
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
2024-02-28 12:57:18 +00:00
%autosetup -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
2022-11-28 07:03:02 +00:00
sed -i 's|^#!%{_bindir}/env bash|#!%{_bindir}/bash|' pre_commit/resources/hook-tmpl
2019-12-03 12:30:51 +00:00
%build
2024-02-28 12:57:18 +00:00
%pyproject_wheel
2019-12-03 12:30:51 +00:00
%install
2024-02-28 12:57:18 +00:00
%pyproject_install
2019-12-03 12:30:51 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitelib}
2021-02-16 13:34:57 +00:00
%python_clone -a %{buildroot} %{_bindir} /pre-commit
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
2023-11-01 15:48:46 +00:00
# test_golang_hook, test_golang_hook_still_works_when_gobin_is_set, test_additional_golang_dependencies_installed, test_local_golang_additional_deps: you need to have go installed
2022-01-11 01:38:20 +00:00
# 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 "
2023-11-01 15:48:46 +00:00
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 s "
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 _ 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 "
2023-01-02 20:20:28 +00:00
# rust_tests use rustup which require network
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 _ p y t h o n _ r e p o _ p y t h o n 2 o r r u s t _ t e s t "
2023-11-01 15:48:46 +00:00
# tests that require network access
2024-02-28 12:57:18 +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 _ e x a m p l e _ e x e c u t a b l e "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ r u n _ d e p "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ 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 "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ 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 "
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r ( g o l a n g _ t e s t a n d t e s t _ d u r i n g _ c o m m i t _ a l l ) "
2023-11-01 15:48:46 +00:00
# requires swift
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ s w i f t _ l a n g u a g e "
2024-01-03 18:40:02 +00:00
%if 0%{?sle_version} <= 150600
# requires network on Leap or SUSE Linux Enterprise
2023-11-28 09:40:37 +00:00
EXCLUDED_TESTS=" $ E X C L U D E D _ T E S T S o r t e s t _ p e r l _ i n s t a l l "
%endif
2022-11-28 07:03:02 +00:00
# Fix issue with git submodule in OBS
git config --global --add protocol.file.allow always
2020-03-18 11:56:14 +00:00
git init .
2024-02-28 12:57:18 +00:00
# Required for python312 https://virtualenv.pypa.io/en/latest/changelog.html#features-20-23-0
export VIRTUALENV_SETUPTOOLS=bundle
export VIRTUALENV_WHEEL=bundle
2020-03-18 11:56:14 +00:00
%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
%postun
%python_uninstall_alternative pre-commit
2019-12-03 12:30:51 +00:00
%files %{python_files}
2023-11-01 15:48:46 +00:00
%license LICENSE
%doc CHANGELOG.md
2021-02-16 13:34:57 +00:00
%python_alternative %{_bindir} /pre-commit
2020-05-04 05:27:19 +00:00
%{python_sitelib} /pre_commit
2024-02-28 12:57:18 +00:00
%{python_sitelib} /pre_commit-%{version} .dist-info
2019-12-03 12:30:51 +00:00
%changelog