File wyoming-faster-whisper.spec of Package wyoming-faster-whisper
#
# spec file for package python-wakeonlan
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define pythons %primary_python
%global username whisper
%global groupname whisper
%global homedir /var/lib/whisper
Name: wyoming-faster-whisper
Version: 2.0.1
Release: 0
License: MIT
Summary: Wyoming Faster Whisper
Group: Development/Languages/Python
Url: https://github.com/rhasspy/wyoming-faster-whisper
Source: %name-%{version}.tar.xz
Source1: wyoming-whisper.service
Source2: wyoming-whisper.sysconf
Patch1: enable-3.13.patch
BuildRequires: %{python_module poetry-core}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wyoming}
BuildRequires: %{python_module black}
BuildRequires: %{python_module isort}
BuildRequires: %{python_module mypy}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: %primary_python-faster_whisper
Requires: %primary_python-wyoming >= 1.5.3
Requires: %primary_python-transformers
# for useradd call
Requires(pre): shadow
Requires(post): update-alternatives
Requires(postun): update-alternatives
Requires(post): %fillup_prereq
Provides: group(%{groupname})
Provides: user(%{username})
BuildArch: noarch
%description
Wyoming Faster Whisper Server
%prep
%setup -q
%patch -P1 -p1
%build
%pyproject_wheel
%install
%pyproject_install
mkdir -p '%{buildroot}'%{_sbindir}
ln -sf service '%{buildroot}'%{_sbindir}/rcwyoming-whisper
install -D -m 644 %{SOURCE1} '%{buildroot}'%{_unitdir}/wyoming-whisper.service
install -D -m 0644 %{SOURCE2} %{buildroot}%{_fillupdir}/sysconfig.wyoming-whisper
mkdir -p %buildroot%homedir
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_clone -a %{buildroot}%{_bindir}/wyoming-faster-whisper
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || \
useradd -r -g %{groupname} -d %{homedir} -s /sbin/nologin \
-c 'Wyoming Whisper User' %{username}
%service_add_pre whisper.service
%preun
%service_del_preun whisper.service
%post
%python_install_alternative wyoming-faster-whisper
%service_add_post whisper.service
%fillup_only -n wyoming-whisper
%postun
%python_uninstall_alternative wyoming-faster-whisper
%service_del_postun whisper.service
%files
%license LICENSE.md
%doc CHANGELOG.md README.md
%python_alternative %{_bindir}/wyoming-faster-whisper
%{_fillupdir}/sysconfig.wyoming-whisper
%_unitdir/wyoming-whisper.service
%_sbindir/rcwyoming-whisper
%{python_sitelib}/*
%dir %attr(0755,%username,%groupname) %homedir
%changelog