File python-websocket-client.spec of Package python-websocket-client

#
# spec file for package python-websocket-client
#
# 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
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define skip_python311 1
%define skip_python312 1
%define short_name websocket

Name:             python-websocket-client
Version:          1.9.0
Release:          0
Summary:          WebSocket client for Python with low level API options
License:          Apache-2.0
URL:              https://github.com/websocket-client/websocket-client
Source0:          https://github.com/websocket-client/websocket-client/archive/refs/tags/v%{version}.tar.gz#/websocket-client-%{version}.tar.gz
BuildRequires:    python-rpm-macros
BuildRequires:    %{python_module setuptools}
BuildRequires:    %{python_module pip}
BuildRequires:    fdupes
Requires(post):   update-alternatives
Requires(postun): update-alternatives
Suggests:         python-Sphinx >= 3.4
Suggests:         python-sphinx_rtd_theme >= 0.5
Suggests:         python-python-socks
Suggests:         python-wsaccel
Suggests:         python-websockets
BuildArch:        noarch
%python_subpackages

%description
WebSocket client for Python with low level API options

%prep
%setup -q -n websocket-client-%{version}
find . -type f -exec sed -i 's@#!%{_bindir}/env python$@#!%{_bindir}/python@' {} +
find . -type f -exec sed -i 's@#!%{_bindir}/env python3$@#!%{_bindir}/python3@' {} +

%build
%pyproject_wheel

%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/wsdump

%python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/websocket/_wsdump.py
%python_expand sed -i '1d' %{buildroot}%{$python_sitelib}/websocket/tests/echo-server.py

%python_expand %fdupes %{buildroot}%{$python_sitelib}

%post
%python_install_alternative wsdump

%postun
%python_uninstall_alternative wsdump

%files %{python_files}
%doc ChangeLog README.md
%license LICENSE
%python_alternative %{_bindir}/wsdump
%{python_sitelib}/%{short_name}*

%changelog

openSUSE Build Service is sponsored by