File gPodder.spec of Package gPodder

#
# spec file for package gPodder
#
# Copyright (c) 2022 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/
#


%{?sle15_python_module_pythons}
Name:           gPodder
Version:        3.11.4
Release:        0
Summary:        A free podcast aggregator for Linux
License:        GPL-3.0-or-later
Group:          Productivity/Multimedia/Sound/Players
URL:            https://gpodder.org
Source:         https://github.com/gpodder/gpodder/archive/%{version}/%{name}-%{version}.tar.gz
Source99:       %{name}-rpmlintrc
BuildRequires:  ImageMagick
#BuildRequires:  dbus-1-python3
BuildRequires:  %{python_module dbus-python}
BuildRequires:  update-desktop-files
BuildRequires:  fdupes
BuildRequires:  gettext-devel
BuildRequires:  help2man
BuildRequires:  hicolor-icon-theme
BuildRequires:  intltool
BuildRequires:  pkgconfig(libgpod-1.0) >= 0.8.3
BuildRequires:  pkgconfig(webkit2gtk-4.1)
Buildrequires:  pkgconfig(gtk+-3.0) >= 3.16
BuildRequires:  %{python_module base >= 3.7}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module mygpoclient >= 1.7}
BuildRequires:  %{python_module podcastparser >= 0.6.0}
BuildRequires:  %{python_module requests >= 2.24.0}
BuildRequires:  %{python_module html5lib}
BuildRequires:  %{python_module gobject >= 3.22.0}
#BuildRequires:  eyeD3 >= 0.7
# SECTION Test Dependencies
BuildRequires:  %{python_module MiniMock}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module pytest-httpserver}
BuildRequires:  %{python_module pytest-cov}
BuildRequires:  desktop-file-utils
# /SECTION Test
Requires:       dbus-1-%{python_flavor}
Requires:       libmp3lame0
Requires:       %{python_flavor}-mygpoclient >= 1.7
Requires:       %{python_flavor}-podcastparser >= 0.6.0
Requires:       %{python_flavor}-requests >= 2.24.0
Requires:       %{python_flavor}-html5lib
Requires:       %{python_flavor}-gobject >= 3.22.0
#Requires:       eyeD3 >= 0.7
Recommends:     MPlayer
Recommends:     yt-dlp
Conflicts:      gpodder < 3.0.0
BuildArch:      noarch

%description
gPodder manages Podcasts for you and automatically downloads selected episodes
from as many channels as you like. Synchronization support is available for
iPods and filesystem-based MP3 players, but Podcasts can (of course) also be
played with any desktop player application.

%prep
%setup -q -n gpodder-%{version}
find -type f -exec sed -i -e 's|\/usr\/bin\/env python3|\/usr\/bin\/python%{python_bin_suffix}|g' {} \;
chmod +x share/gpodder/examples/gpodder_mark_played.py 

%build

%install
# Without this the install chokes on non-ascii characters
export LANG=en_US.utf8
make DESTDIR=%{buildroot} install %{?_smp_mflags} PREFIX=%{_prefix} PYTHON=python%{python_bin_suffix}

# remove shebangs from .py files that are in sitelib:
find %{buildroot}%{python_sitelib} -name '*.py' \
| while read f; do
    case $(head -1 "$f") in
        \#!*) %__sed -i '1d' "$f" ;;
    esac
done

# recompile all .py files because their timestamp doesn't match
pushd %{buildroot}%{python_sitelib}/gpodder
%py3_compile -O .
popd

rm -rf %{buildroot}%{_datadir}/icons/*/{26,40}x*

%fdupes %{buildroot}

%suse_update_desktop_file -r gpodder AudioVideo Player

%find_lang gpodder

%if !0%(?suse_version) > 1500
%check
%pytest
%endif

%files -f gpodder.lang
%license COPYING
%doc README.md
%{_bindir}/gpo
%{_bindir}/gpodder
%{_bindir}/gpodder-migrate2tres
%{python_sitelib}/gpodder
%{_datadir}/gpodder
%{_datadir}/metainfo
%exclude %{_datadir}/gpodder/extensions/ubuntu_unity.*
%{_datadir}/applications/gpodder.desktop
%{_datadir}/applications/gpodder-url-handler.desktop
%{_datadir}/dbus-1/services/org.gpodder.service
%{_datadir}/icons/*/*/apps/gpodder.*
%{_mandir}/man1/gpo.1%{?ext_man}
%{_mandir}/man1/gpodder.1%{?ext_man}
%{_mandir}/man1/gpodder-migrate2tres.1%{?ext_man}
%{python_sitelib}/gpodder-%{version}-py%{python_bin_suffix}.egg-info

%changelog
openSUSE Build Service is sponsored by