ad4fbe1
# Sphinx-generated HTML documentation is not suitable for packaging; see
ad4fbe1
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
ad4fbe1
#
ad4fbe1
# We can generate PDF documentation as a substitute.
ad4fbe1
%bcond_without doc_pdf
ad4fbe1
0bb4078
%if 0%{?el9}
0bb4078
# https://bugzilla.redhat.com/show_bug.cgi?id=2034654
0bb4078
%bcond_with gevent
0bb4078
%else
0bb4078
%bcond_without gevent
0bb4078
%endif
0bb4078
55b4e60
Summary:        OpenTracing interface for Python
55b4e60
Name:           python-opentracing
55b4e60
Version:        2.4.0
5830061
Release:        12%{?dist}
2b3aa33
55b4e60
# The files are under the Apache License 2.0,
55b4e60
# except for:
55b4e60
# - mocktracer-related files
55b4e60
# - scope-related files
55b4e60
# - tests/conftest.py
55b4e60
# which are under the Expat License (classified as MIT by the Open
55b4e60
# Source Initiative).
55b4e60
License:        ASL 2.0 and MIT
9fe29ad
URL:            https://github.com/opentracing/opentracing-python
43064bf
Source0:        %{url}/archive/%{version}/opentracing-python-%{version}.tar.gz
55b4e60
55b4e60
# Issue filed upstream as https://github.com/opentracing/opentracing-python/issues/142
55b4e60
# Upstream has merged the change on master as https://github.com/opentracing/opentracing-python/pull/143
55b4e60
Patch0:         0001-Do-not-use-mock-the-PyPI-backport-library-when-possi.patch
4a74ca6
# Replace @asyncio.coroutine with “async def” for Python 3.11
4a74ca6
# https://github.com/opentracing/opentracing-python/pull/159
4a74ca6
Patch1:         %{url}/pull/159.patch
55b4e60
55b4e60
BuildArch:      noarch
ad4fbe1
55b4e60
BuildRequires:  python3-devel
ad4fbe1
412389f
BuildRequires:  make
ad4fbe1
BuildRequires:  texinfo
ad4fbe1
%if %{with doc_pdf}
ad4fbe1
BuildRequires:  python3-sphinx-latex
ad4fbe1
BuildRequires:  latexmk
55b4e60
# Required to provide its intersphinx inventory
ad4fbe1
%if ! 0%{?el9}
55b4e60
BuildRequires:  python3-docs
ad4fbe1
%endif
ad4fbe1
%endif
ad4fbe1
55b4e60
%global _description %{expand:
55b4e60
This library is a Python platform API for OpenTracing.
55b4e60
55b4e60
It allows Python programs to interact with an OpenTracing server.}
55b4e60
55b4e60
%description
55b4e60
%{_description}
55b4e60
55b4e60
%prep
9fe29ad
%autosetup -n opentracing-python-%{version} -p1
ad4fbe1
%if 0%{?el9}
ad4fbe1
echo 'intersphinx_mapping.clear()' >> docs/conf.py
ad4fbe1
%else
2b3aa33
# Reconfigure intersphinx to use the local inventory.
2b3aa33
sed -e '/^ \+.python.:/s,None,"%{_docdir}/python3-docs/html/objects.inv",' -i docs/conf.py
ad4fbe1
%endif
412389f
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
412389f
sed -r -i '/\b(pytest-cov|flake8(-quotest)?)\b/d' setup.py
0bb4078
# https://pypi.org/project/doubles/ is not yet packaged, and does not seem to
0bb4078
# be used in practice.
0bb4078
sed -r -i '/\bdoubles\b/d' setup.py
0bb4078
%if %{without gevent}
0bb4078
# https://bugzilla.redhat.com/show_bug.cgi?id=2034654
0bb4078
sed -r -i '/\bgevent\b/d' setup.py
0bb4078
%endif
0bb4078
0bb4078
%generate_buildrequires
0bb4078
%pyproject_buildrequires -x tests
55b4e60
55b4e60
%build
0bb4078
%pyproject_wheel
55b4e60
55b4e60
# Generate the documentation.
0bb4078
for target in info %{?with_doc_pdf:latex}
0bb4078
do
0bb4078
  PYTHONPATH="%{pyproject_build_lib}" \
0bb4078
      %make_build -C docs "${target}" SPHINXOPTS='%{?_smp_mflags}'
0bb4078
done
ad4fbe1
%if %{with doc_pdf}
ad4fbe1
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
ad4fbe1
%endif
55b4e60
55b4e60
%install
0bb4078
%pyproject_install
0bb4078
%pyproject_save_files opentracing
55b4e60
mkdir -p %{buildroot}%{_infodir}
9fe29ad
cp -p docs/_build/texinfo/opentracing-python.info %{buildroot}%{_infodir}/
55b4e60
55b4e60
%check
412389f
# Based on the “test” Makefile target, but with coverage options removed
0bb4078
%pytest \
0bb4078
%if %{without gevent}
0bb4078
    --ignore='tests/scope_managers/test_gevent.py' \
0bb4078
%endif
0bb4078
    --tb short -rxs opentracing tests
55b4e60
55b4e60
%package -n python3-opentracing
55b4e60
Summary: %{summary}
55b4e60
55b4e60
%description -n python3-opentracing
55b4e60
%{_description}
55b4e60
0bb4078
%files -n python3-opentracing -f %{pyproject_files}
0bb4078
# pyproject_files handles LICENSE; verify with “rpm -qL -p …”
55b4e60
%doc README.rst
55b4e60
%doc CHANGELOG.rst
9fe29ad
%{_infodir}/opentracing-python.info*
55b4e60
55b4e60
%package doc
ad4fbe1
Summary: %{summary} - documentation
55b4e60
55b4e60
%description doc
55b4e60
%{_description}
55b4e60
ad4fbe1
This package contains the documentation.
55b4e60
55b4e60
%files doc
55b4e60
%license LICENSE
ad4fbe1
%if %{with doc_pdf}
ad4fbe1
%doc docs/_build/latex/opentracing-python.pdf
ad4fbe1
%endif
55b4e60
55b4e60
%changelog
5830061
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-12
5830061
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
5830061
fa6cda7
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-11
fa6cda7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
fa6cda7
9e6c7e1
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-10
9e6c7e1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
9e6c7e1
2ab9999
* Thu Jun 22 2023 Python Maint <python-maint@redhat.com> - 2.4.0-9
2ab9999
- Rebuilt for Python 3.12
2ab9999
02b2b73
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-8
02b2b73
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
02b2b73
ccc5fbd
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-7
ccc5fbd
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
ccc5fbd
4a74ca6
* Mon Jun 20 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2.4.0-6
4a74ca6
- Fix Python 3.11 compatibility
4a74ca6
7ee4564
* Tue Jun 14 2022 Python Maint <python-maint@redhat.com> - 2.4.0-5
7ee4564
- Rebuilt for Python 3.11
7ee4564
9fe29ad
* Fri Apr 22 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 2.4.0-4
9fe29ad
- Assorted minor spec file cleanup
ad4fbe1
- Build Sphinx-generated documentation as PDF instead of HTML
0bb4078
- Switch to pyproject-rpm-macros (“new Python guidelines”)
9fe29ad
fec3ae3
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-3
fec3ae3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
fec3ae3
847ad8c
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.4.0-2
847ad8c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
847ad8c
55b4e60
* Thu Dec 10 2020 Fabrice BAUZAC <noon@mykolab.com> 2.4.0-1
55b4e60
- Initial version.