Convert to pyproject-rpm-macros

epel9
Miro Hrončok 4 years ago
parent df25d483f1
commit 8aaf74cd4e

@ -1,13 +1,11 @@
%global srcname hypothesis
Name: python-%{srcname}
Name: python-hypothesis
Version: 6.6.0
Release: 1%{?dist}
Summary: Library for property based testing
License: MPLv2.0
URL: https://github.com/HypothesisWorks/hypothesis
Source0: %{url}/archive/%{srcname}-python-%{version}/%{srcname}-%{version}.tar.gz
Source0: %{url}/archive/hypothesis-python-%{version}/hypothesis-%{version}.tar.gz
BuildArch: noarch
@ -15,14 +13,26 @@ BuildArch: noarch
%bcond_without tests
%bcond_without doc
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: pyproject-rpm-macros
%if %{with tests}
# The test requires used by tox are defined in requirements/test.txt,
# but they are pinned, incl. transitive deps.
# The file is generated from requirements/test.in which has:
BuildRequires: %{py3_dist pexpect}
BuildRequires: %{py3_dist pytest}
BuildRequires: %{py3_dist pytest-xdist}
# RFE to use that file directly: https://bugzilla.redhat.com/show_bug.cgi?id=1936448
%endif
%if %{with doc}
# Manpage
BuildRequires: %{_bindir}/sphinx-build
BuildRequires: %{py3_dist sphinx-hoverxref}
BuildRequires: %{py3_dist sphinx-rtd-theme}
BuildRequires: %{py3_dist sphinx_selective_exclude}
%endif
%global _description %{expand:
Hypothesis is a library for testing your Python code against a much
larger range of examples than you would ever want to write by
@ -32,84 +42,67 @@ flow.}
%description %{_description}
%package -n python%{python3_pkgversion}-%{srcname}
%package -n python%{python3_pkgversion}-hypothesis
Summary: %{summary}
%{?python_provide:%python_provide python%{python3_pkgversion}-%{srcname}}
Obsoletes: platform-python-%{srcname} < %{version}-%{release}
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: %{py3_dist attrs} >= 19.2.0
BuildRequires: %{py3_dist sortedcontainers}
%if %{with tests}
BuildRequires: black
BuildRequires: %{py3_dist lark-parser}
BuildRequires: %{py3_dist numpy}
BuildRequires: %{py3_dist pandas}
BuildRequires: %{py3_dist pexpect}
BuildRequires: %{py3_dist pytest}
BuildRequires: %{py3_dist pytest-xdist}
BuildRequires: %{py3_dist typing-extensions}
%endif
%description -n python%{python3_pkgversion}-%{srcname} %{_description}
Python 3 version.
%{?python_extras_subpkg:
%{python_extras_subpkg -n python%{python3_pkgversion}-%{srcname} -i %{python3_sitelib}/hypothesis-*.egg-info
cli
ghostwriter
pytz
dateutil
lark
numpy
pandas
pytest
redis
zoneinfo
django
}}
%description -n python%{python3_pkgversion}-hypothesis %{_description}
%global extras cli ghostwriter pytz dateutil lark numpy pandas pytest redis zoneinfo django
# extras with missing deps:
# codemods: libcst
# dpcontracts: dpcontracts
# codemods: libcst
# dpcontracts: dpcontracts
%{pyproject_extras_subpkg -n python%{python3_pkgversion}-hypothesis %{extras}}
%prep
%autosetup -n %{srcname}-%{srcname}-python-%{version}/%{srcname}-python -p2
%autosetup -n hypothesis-hypothesis-python-%{version}/hypothesis-python -p2
# disable Sphinx extensions that require Internet access
sed -i -e '/sphinx.ext.intersphinx/d' docs/conf.py
# remove tests we cannot run
rm -r tests/dpcontracts tests/redis # missing deps
%generate_buildrequires
# RFE to avoid the tr: https://bugzilla.redhat.com/show_bug.cgi?id=1936486
%pyproject_buildrequires %{?with_tests:-x %(echo %{extras} | tr ' ' ',')}
%build
%py3_build
%pyproject_wheel
%if %{with doc}
PYTHONPATH=src READTHEDOCS=True sphinx-build -b man docs docs/_build/man
%endif
%install
%py3_install
%pyproject_install
%pyproject_save_files hypothesis
%if %{with doc}
%{__install} -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/hypothesis.1
install -Dpm0644 -t %{buildroot}%{_mandir}/man1 docs/_build/man/hypothesis.1
%endif
%if %{with tests}
%check
%pytest -v -n auto \
-k "not test_registered_from_entrypoint" \
--ignore tests/codemods \
--ignore tests/dpcontracts \
--ignore tests/redis \
%endif
%files -n python%{python3_pkgversion}-%{srcname}
%files -n python%{python3_pkgversion}-hypothesis -f %{pyproject_files}
%license ../LICENSE.txt
%doc README.rst
%{_bindir}/hypothesis
%{python3_sitelib}/hypothesis-*.egg-info
%{python3_sitelib}/hypothesis/
%if %{with doc}
%{_mandir}/man1/hypothesis.1*
%endif
%changelog
* Mon Mar 08 2021 Miro Hrončok <mhroncok@redhat.com> - 6.6.0-1
- Update to 6.6.0

Loading…
Cancel
Save