File svtplay-dl.spec of Package svtplay-dl

# 1 = enabled, 0 = disabled
%define with_tests 0
%define __python /usr/bin/python3
%define _executable svtplay-dl
%define _installToDir /usr

Name:           svtplay-dl
Version:        0.0.0
Release:        0
Summary:        Download videos
License:        MIT
Group:          Development/Languages/Python
URL:            https://github.com/spaam/svtplay-dl
Source:         %{name}-%{version}.tar.xz
BuildArch:      noarch
BuildRequires:  python3-devel
BuildRequires:  python-rpm-macros
BuildRequires:  zip
BuildRequires:  git
%if 0%{?with_tests}
BuildRequires:  python3-pytest
%endif
Requires:   (ffmpeg-free or ffmpeg or ffmpeg-6 or ffmpeg-5 or ffmpeg-4 or libav-tools)
%if 0%{?fedora_version}
# Fedora
Requires:   python3-requests
Requires:   python3-cryptography
Requires:   python3-pyaml
Suggests:   python3-pysocks
%endif
%if 0%{?sle_version} == 150500 || 0%{?sle_version} == 150600 || 0%{?sle_version} == 160000 && 0%{?is_opensuse}
# openSUSE Tumbleweed
Requires:   python3-requests
Requires:   python3-cryptography
Requires:   python3-pyaml
Suggests:   python3-pysocks
%endif
%if 0%{?suse_version} > 1500
# openSUSE Tumbleweed
Requires:   python311-requests
Requires:   python311-cryptography
Requires:   python311-pyaml
Suggests:   python311-pysocks
%endif

%description
svtplay-dl is an open source command-line program written in python.
You can quickly download published videos from various sites to your
local computer.

%prep
%autosetup -p1

%build
echo "Fix version number out of git"
export pkgver=$(echo %{version} | cut -d'.' -f 1-2)
sed -i "s|VERSION\ =\ \(.*\)|VERSION = "$pkgver"|g" lib/Makefile
make

%install
export PREFIX=%{_installToDir}
make install DESTDIR="%{buildroot}"
#mv -v %%{buildroot}%%{_installToDir}/bin/%%{_executable} %%{buildroot}%%{_installToDir}/bin/%%{_executable}-git
mkdir -p %{buildroot}/usr/share/man/man1
#install -m 644 /home/abuild/rpmbuild/SOURCES/manual %{buildroot}/usr/share/man/man1/%{_executable}.1
gzip -c /home/abuild/rpmbuild/SOURCES/manual > %{buildroot}/usr/share/man/man1/%{_executable}.1.gz
echo "--- List files that will be packaged ---"
find %{buildroot} | sed "s|%{buildroot}||g"
echo "--- End list files that will be packaged ---"

%files
%exclude %dir /usr
%exclude %dir /usr/bin
%exclude %dir /usr/local
%exclude %dir /usr/local/bin
%exclude %dir /usr/share
%exclude %dir /usr/share/man
%exclude %dir /usr/share/man/man1
%license LICENSE
/usr/bin/svtplay-dl
/usr/share/man/man1/svtplay-dl.*

%changelog
* Wed Jan 08 2025 Nobody  4.101
- New release.
openSUSE Build Service is sponsored by