%global debug_package %{nil} %global gituser yt-dlp %global gitname yt-dlp %global foldername yt_dlp %global commit 0b6b7742c2e7f2a1fcb0b54ef3dd484bab404b3f %global shortcommit %(c=%{commit}; echo ${c:0:7}) %global gitcounter 2 Name: yt-dlp Version: 2024.12.23.git.%{gitcounter} Release: %{shortcommit}%{?dist} Summary: A feature-rich command-line audio/video downloader License: Unlicense URL: https://github.com/%{gituser}/%{gitname} Source0: %{url}/tarball/%{commit}#/%{gituser}-%{name}-%{shortcommit}.tar.gz # Patch1: %%{url}/pull/8760.patch#/Attempting_to_fix_503_error_for_ARDMediathek_8760.patch BuildRequires: %{py3_dist pytest} # Needed to query completion locations and to make docs %if 0%{?fedora} <= 40 BuildRequires: bash-completion %else BuildRequires: bash-completion-devel %endif BuildRequires: fish pandoc BuildRequires: %{py3_dist urllib3} %{py3_dist requests} %{py3_dist brotli} %{py3_dist certifi} BuildRequires: %{py3_dist pycryptodomex} %{py3_dist mutagen} %{py3_dist secretstorage} BuildRequires: %{py3_dist websockets} Requires: %{py3_dist urllib3} %{py3_dist requests} %{py3_dist brotli} %{py3_dist certifi} Recommends: %{py3_dist pycryptodomex} %{py3_dist mutagen} %{py3_dist secretstorage} Recommends: %{py3_dist websockets} Obsoletes: yt-dlp-bash-completion < %{version} Obsoletes: yt-dlp-fish-completion < %{version} Obsoletes: yt-dlp-zsh-completion < %{version} BuildArch: noarch %description YT-DLP is a feature-rich command-line audio/video downloader with support for thousands of sites. The project is a fork of youtube-dl based on the now inactive youtube-dlc. %prep %autosetup -p1 -n %{gituser}-%{gitname}-%{shortcommit} mv -f CONTRIBUTORS AUTHORS # Remove pycryptodomex requirement (just recommend) sed -i '/pycryptodomex/d' pyproject.toml # Set requests min to 2.28.2 sed -i 's|>=2.32.2|>=2.28.2|' pyproject.toml sed -i 's|0x023202|0x022802|' yt_dlp/networking/_requests.py # Remove README.txt sed -i '/README.txt/d' pyproject.toml mkdir -p completions/{bash,zsh,fish} %{python3} devscripts/bash-completion.py %{python3} devscripts/fish-completion.py %{python3} devscripts/zsh-completion.py # Enable lazy-extractors %{python3} devscripts/make_lazy_extractors.py %{foldername}/extractor/lazy_extractors.py # Setup version info sed -i '/RELEASE_GIT_HEAD/d' %{foldername}/version.py echo "RELEASE_GIT_HEAD = '"%{commit}"'" >> %{foldername}/version.py # make docs (from Makefile) MARKDOWN="markdown-smart" %{python3} devscripts/prepare_manpage.py %{name}.1.temp pandoc -s -f "$MARKDOWN" -t man %{name}.1.temp -o %{name}.1 mv -f README.md README.md.temp pandoc -f "$MARKDOWN" -t plain README.md.temp -o README.md mv -f Changelog.md Changelog.md.temp pandoc -f "$MARKDOWN" -t plain Changelog.md.temp -o Changelog.md rm -f %{name}.1.temp README.md.temp Changelog.md.temp supportedsites.md %{python3} devscripts/make_supportedsites.py supportedsites.md # Remove interpreter shebang from module files find %{foldername} -type f -exec sed -i -e '1{/^\#!\/usr\/bin\/env python$/d;};' {} + %generate_buildrequires %pyproject_buildrequires -r %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{foldername} mkdir -p %{buildroot}%{_sysconfdir} cat > %{buildroot}%{_sysconfdir}/%{name}.conf << EOF # Default configuration for yt-dlp. --prefer-free-formats --hls-prefer-native EOF # Check completion locations cd %{buildroot}$(pkg-config --variable completionsdir bash-completion) if ! [ -f "%{name}" ]; then exit 1; fi cd %{buildroot}$(pkg-config --variable completionsdir fish) if ! [ -f "%{name}.fish" ]; then exit 1; fi %check # %%pytest -Werror -k "not download" %pytest -k "not download" # AUTHORS and LICENSE already in dist-info %files -f %{pyproject_files} %doc Changelog.md README.md supportedsites.md %{_bindir}/%{name} %{_mandir}/man1/%{name}.1* %config(noreplace) %{_sysconfdir}/%{name}.conf %{_datadir}/bash-completion/completions/%{name} %{_datadir}/fish/vendor_completions.d/%{name}.fish %{_datadir}/zsh/site-functions/_%{name} %changelog * Wed Mar 20 2024 samoht0 git-master - history cleanup - description update