File yt-dlg.spec of Package yt-dlg

#
# spec file for package yt-dlg
#
# Copyright (c) 2023 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 oname youtube-dl-gui
%global srcname yt_dlg
%define skip_python2 1

%bcond_with master

Name:           yt-dlg
Summary:        GUI for youtube-dl
License:        Unlicense
Group:          Productivity/Networking/Web/Utilities
URL:            https://github.com/oleksis/youtube-dl-gui
%if %{with master}
Version:        1.8.5
Release:        0.git20230224
Source:         https://github.com/oleksis/youtube-dl-gui/archive/refs/heads/master.tar.gz#/%{oname}-master.tar.gz
%else
Version:        1.8.5
Release:        0
Source:         https://files.pythonhosted.org/packages/source/y/yt-dlg/%{srcname}-%{version}.tar.gz
%endif
BuildRequires:  %{python_module polib}
BuildRequires:  %{python_module pypubsub}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module wxPython}
BuildRequires:  -post-build-checks
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-rpm-macros
BuildRequires:  update-desktop-files

BuildArch:      noarch

Requires:       python-pypubsub
Requires:       python-wxPython
Requires(post): update-alternatives
Requires(postun):update-alternatives
Recommends:     ffmpeg
Obsoletes:      %{oname} < %{version}
Provides:       %{oname} == %{version}

%python_subpackages

%description
A front-end GUI for the popular youtube-dl written in wxPython.

%prep
%if %{with master}
%setup -q -n %{oname}-master
%else
%setup -q -n %{srcname}-%{version}
%endif

%build
%python_build -- build_trans no_updates

%install
%python_install
%find_lang youtube_dl_gui
%__install -Dm0644 %{_sourcedir}/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop

%python_clone -a %{buildroot}%{_bindir}/yt-dlg
%python_clone -a %{buildroot}%{_mandir}/man1/youtube-dl-gui.1
%python_expand %fdupes %{buildroot}%{$python_sitelib}

cat << EOF > README.install.urpmi
This application downloads the last youtube-dl on ~/.config/yt-dlg
EOF
chmod a+r README.install.urpmi
%python_expand sed -e 's/pyinstaller<=5.6.2,>=3.6//g' -i %{buildroot}%{$python_sitelib}/yt_dlg-%{version}-py%{$python_version}.egg-info/requires.txt

%post
%python_install_alternative yt-dlg

%postun
%python_uninstall_alternative yt-dlg

%files %{python_files}
%doc AUTHORS README.md TODO README.install.urpmi
%license LICENSE
%dir %{python_sitelib}/youtube_dl_gui
%dir %{python_sitelib}/yt_dlg-%{version}-py%{python_version}.egg-info
%python_alternative %{_bindir}/yt-dlg
%python_alternative %{_mandir}/man1/youtube-dl-gui.1%{ext_man}
%{_datadir}/applications/yt-dlg.desktop
%{_datadir}/pixmaps/%{oname}.png
%{_datadir}/icons/hicolor/*/apps/%{oname}.png
%{python_sitelib}/youtube_dl_gui/*
%{python_sitelib}/yt_dlg-%{version}-py%{python_version}.egg-info/*

%changelog
openSUSE Build Service is sponsored by