e26c622
# Sphinx-generated HTML documentation is not suitable for packaging; see
e26c622
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
e26c622
#
e756f4e
# We can generate PDF documentation as a substitute.
e26c622
%bcond_without doc_pdf
e26c622
720b0e7
Name:           python-engineio
0e33be6
Version:        4.4.1
a839324
Release:        %autorelease
e19c833
Summary:        Python Engine.IO server and client
7a555a1
861c53a
# SPDX
7a555a1
License:        MIT
720b0e7
URL:            https://github.com/miguelgrinberg/python-engineio/
720b0e7
Source0:        %{url}/archive/v%{version}/python-engineio-%{version}.tar.gz
7a555a1
c2dd8dd
# Downstream-only: patch out test coverage analysis
c2dd8dd
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
c2dd8dd
Patch:          0001-Downstream-only-patch-out-test-coverage-analysis.patch
c2dd8dd
7a555a1
BuildArch:      noarch
7a555a1
 
7a555a1
BuildRequires:  python3-devel
e19c833
e19c833
# Documentation
e26c622
%if %{with doc_pdf}
e19c833
BuildRequires:  make
e19c833
BuildRequires:  python3dist(sphinx)
e26c622
BuildRequires:  python3-sphinx-latex
e26c622
BuildRequires:  latexmk
e26c622
%endif
e19c833
e19c833
%global common_description %{expand:
e19c833
Engine.IO is a lightweight transport protocol that enables real-time
e19c833
bidirectional event-based communication between clients (typically, though not
e19c833
always, web browsers) and a server. The official implementations of the client
e19c833
and server components are written in JavaScript. This package provides Python
e19c833
implementations of both, each with standard and asyncio variants.}
e19c833
e19c833
%description %{common_description}
e19c833
e19c833
720b0e7
%package -n     python3-engineio
7a555a1
Summary:        %{summary}
7a555a1
720b0e7
%description -n python3-engineio %{common_description}
e19c833
e19c833
720b0e7
%pyproject_extras_subpkg -n python3-engineio client asyncio_client
e19c833
e19c833
e19c833
%package        doc
720b0e7
Summary:        Documentation for python-engineio
e19c833
e19c833
%description    doc %{common_description}
7a555a1
7a555a1
7a555a1
%prep
e19c833
%autosetup -p1
e19c833
e19c833
# Remove pre-compiled/pre-minified browser build of
e19c833
# https://github.com/socketio/engine.io from the examples. This makes them less
e19c833
# useful, but satisfies
e19c833
# https://docs.fedoraproject.org/en-US/packaging-guidelines/JavaScript/ and
e19c833
# https://docs.fedoraproject.org/en-US/packaging-guidelines/#bundling. It
e19c833
# doesn’t seem worth it to package the JavaScript implementation of Engine.IO
e19c833
# just for the sake of these examples.
337affd
#
337affd
# Don’t ship package-lock.json files with the examples, to keep from having
337affd
# automated bugs filed for irrelevant CVE’s in NPM packages that are mentioned
337affd
# there. See RHBZ#2127005.
337affd
find examples -type f \( -name 'engine.io.js' -o -name 'package-lock.json' \) \
337affd
    -print -delete
e19c833
7a555a1
696aca0
%generate_buildrequires
a544edf
%pyproject_buildrequires -x client,asyncio_client -t
696aca0
696aca0
7a555a1
%build
e19c833
%pyproject_wheel
e26c622
%if %{with doc_pdf}
881302b
PYTHONPATH="${PWD}/src" %make_build -C docs latex \
881302b
    SPHINXOPTS='-j%{?_smp_build_ncpus}'
e756f4e
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'
e26c622
%endif
e19c833
7a555a1
7a555a1
%install
e19c833
%pyproject_install
720b0e7
%pyproject_save_files engineio
e19c833
7a555a1
7a555a1
%check
3046a93
%pytest
e19c833
7a555a1
720b0e7
%files -n python3-engineio -f %{pyproject_files}
e19c833
e19c833
e19c833
%files doc
e19c833
%license LICENSE
e19c833
%doc CHANGES.md
a544edf
%doc README.md
a544edf
%doc SECURITY.md
e26c622
%if %{with doc_pdf}
e26c622
%doc docs/_build/latex/python-engineio.pdf
e26c622
%endif
e19c833
# Bundled pre-compiled engine.io.js has been removed:
e19c833
%doc examples
e19c833
7a555a1
7a555a1
%changelog
a839324
%autochangelog