File tartube.spec of Package tartube

#
# spec file for package tartube
#
# 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}
%define pythons python311
Name:           tartube
Version:        2.5.0
Release:        0
Summary:        A GUI front-end for youtube-dl
License:        GPL-3.0-only
Group:          Productivity/Multimedia/Other
URL:            https://github.com/axcore/tartube
Source0:        https://github.com/axcore/tartube/archive/v%{version}/%{name}-%{version}.tar.gz
BuildArch:      noarch
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module feedparser}
BuildRequires:  %{python_module gobject}
BuildRequires:  %{python_module matplotlib-gtk3}
###BuildRequires:  %%{python_module moviepy}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module playsound}
###BuildRequires:  %%{python_module pgi}
BuildRequires:  %{python_module requests}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  update-desktop-files
Requires:       AtomicParsley
Requires:       ffmpeg
Requires:       %{python_flavor}-feedparser
Requires:       %{python_flavor}-gobject
Requires:       %{python_flavor}-matplotlib-gtk3
Requires:       %{python_flavor}-playsound
Requires:       %{python_flavor}-requests
#Requires:       youtube-dl
Requires:       yt-dlp

%description
A GUI front-end for youtube-dl, partly based on youtube-dl-gui and written in Python 3 / Gtk 3

%prep
%setup -q -n tartube-%{version}
# rpmlint
find . -type f -name "*.py" -exec sed -i -e 's|\/usr\/bin\/env python3|\/usr\/bin\/python%{python_bin_suffix}|g' {} \;
find . -type f -name "tartube" -exec sed -i -e 's|\/usr\/bin\/env python3|\/usr\/bin\/python%{python_bin_suffix}|g' {} \;
###find . -type f -name "*.py" -exec chmod -x {} \;

%build
# Remove export CFLAGS=... for noarch packages (unneeded)
export CFLAGS="%{optflags}"
export TARTUBE_PKG_STRICT=1
%python_build

%install
%python_install
# Fix python-bytecode-inconsistent-mtime
pushd %{buildroot}%{python_sitelib}
find . -name '*.pyc' -exec rm -f '{}' ';'
python%python_bin_suffix -m compileall *.py ';'
popd

# (tv) fix installation (& thus startup):
mkdir -p %{buildroot}%{_datadir}/tartube/
mv %{buildroot}/tartube %{buildroot}%{_datadir}/

mkdir -p %{buildroot}%{_mandir}/man1
install -m 0644 pack/tartube.1 %{buildroot}%{_mandir}/man1

mkdir -p %{buildroot}%{_datadir}/pixmaps
install -m 0644 pack/tartube.png %{buildroot}%{_datadir}/pixmaps

mkdir -p  %{buildroot}%{_datadir}/applications
install -m 0644 pack/tartube.desktop %{buildroot}%{_datadir}/applications

%suse_update_desktop_file -r tartube AudioVideo AudioVideoEditing

%python_expand %fdupes %{buildroot}%{$python_sitelib}
%fdupes %{buildroot}%{_datadir}/tartube/icons

%check
#%%python_expand $$python setup.py test

%files
%license LICENSE
%doc README.rst
%{python_sitelib}/*
%{_bindir}/tartube
%{_datadir}/applications/tartube.desktop
%{_datadir}/pixmaps/tartube.png
%{_datadir}/tartube/
%{_mandir}/man1/*

%changelog
openSUSE Build Service is sponsored by