Blob Blame History Raw
# Sphinx-generated HTML documentation is not suitable for packaging; see
# for discussion.
# We can generate PDF documentation as a substitute.
%bcond doc_pdf 1

Name:           python-socketio
Version:        5.11.2
Release:        %autorelease
Summary:        Socket.IO server

License:        MIT
Source:         %{url}/archive/v%{version}/python-socketio-%{version}.tar.gz

# Downstream-only: patch out test coverage analysis
Patch:          0001-Downstream-only-patch-out-test-coverage-analysis.patch

BuildArch:      noarch

BuildRequires:  python3-devel

# Documentation
%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk

# Extra testing dependencies
BuildRequires:  python3dist(pytest)

%global common_description %{expand:
Socket.IO is a transport protocol that enables real-time bidirectional
event-based communication between clients (typically, though not always, web
browsers) and a server. The official implementations of the client and server
components are written in JavaScript. This package provides Python
implementations of both, each with standard and asyncio variants.}

%description %{common_description}

%package -n     python3-socketio
Summary:        %{summary}

%description -n python3-socketio %{common_description}

%pyproject_extras_subpkg -n python3-socketio client asyncio_client

%package        doc
Summary:        Documentation for python-socketio

%description    doc %{common_description}

%autosetup -p1
# Fix “/usr/bin/env python” shebangs in the examples
%py3_shebang_fix examples
# Don’t ship package-lock.json files with the examples. Overzealous bug-filing
# scripts will file issues on this project for CVE’s in the recursive
# dependencies mentioned there even though they are not present in or used by
# this package at all.
find examples -type f -name package-lock.json -print -delete

%pyproject_buildrequires -x client,asyncio_client%{?with_doc_pdf:docs} -t

%if %{with doc_pdf}
PYTHONPATH="${PWD}/src" %make_build -C docs latex \
%make_build -C docs/_build/latex LATEXMKOPTS='-quiet'

%pyproject_save_files -l socketio


%files -n python3-socketio -f %{pyproject_files}

%files doc
%license LICENSE
%if %{with doc_pdf}
%doc docs/_build/latex/python-socketio.pdf
%doc examples/