15
0
forked from pool/python-hunter

- Switch to pyproject macros.

- Actually run the testsuite.
- No more greedy globs in %files.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-hunter?expand=0&rev=12
This commit is contained in:
2025-07-04 01:52:32 +00:00
committed by Git OBS Bridge
parent 90b68b0294
commit 8663ae2e6a
4 changed files with 113 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-hunter
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -23,8 +23,22 @@ Summary: Pytest plugin for coverage reporting
License: BSD-2-Clause
URL: https://github.com/ionelmc/python-hunter
Source: https://files.pythonhosted.org/packages/source/h/hunter/hunter-%{version}.tar.gz
# PATCH-FIX-OPENSUSE Fix the testsuite to build with Python 3.13
Patch0: support-python-313.patch
# PATCH-FIX-UPSTREAM gh#ionelmc/python-hunter#126
Patch1: use-sys.executable.patch
BuildRequires: %pythons
BuildRequires: %{python_module Cython}
BuildRequires: %{python_module aspectlib}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module process-tests}
BuildRequires: %{python_module pytest-benchmark}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module py}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module six}
BuildRequires: %{python_module tzdata}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires(post): update-alternatives
@@ -37,16 +51,37 @@ but for debugging, logging, inspection and other nefarious purposes.
%prep
%autosetup -p1 -n hunter-%{version}
cat >src/build_tests.py <<EOF
from setuptools import setup
from Cython.Build import cythonize
setup(
name='Tests',
ext_modules=cythonize("../tests/*.pyx"),
)
EOF
%build
%python_build
%pyproject_wheel
export PYTHONDONTWRITEBYTECODE=1
pushd src
%python_exec build_tests.py build_ext
find . -name 'eviltracer.cpython-*-linux-gnu.so' -exec mv "{}" ../tests \;
find . -name 'sample5.cpython-*-linux-gnu.so' -exec mv "{}" ../tests \;
rm build_tests.py
popd
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitearch}/
%pyproject_install
%{python_expand \
rm -r %{buildroot}%{$python_sitearch}/build_tests.py %{buildroot}%{$python_sitearch}/__pycache__
%fdupes %{buildroot}%{$python_sitearch}/
}
%python_clone -a %{buildroot}%{_bindir}/hunter-trace
%check
export PYTHONPATH=tests
%pytest_arch -k 'not (test_pdb and (postmortem-ipdb or settrace-ipdb or debugger-ipdb) or test_fullsource_cython or test_source_cython or test_safe_repr or test_profile or test_errorsnooper)' --ignore tests/test_remote.py --ignore tests/test_integration.py
%post
%python_install_alternative hunter-trace
@@ -58,6 +93,8 @@ but for debugging, logging, inspection and other nefarious purposes.
%python_alternative %{_bindir}/hunter-trace
%license LICENSE
%doc AUTHORS.rst CHANGELOG.rst README.rst
%{python_sitearch}/*
%{python_sitearch}/hunter
%{python_sitearch}/hunter.pth
%{python_sitearch}/hunter-%{version}.dist-info
%changelog