# Maintainer: exponential # Contributor: katt (AUR) pkgname=yt-dlp-git _pkgname="${pkgname%-git}" pkgver=2024.04.09.r26.ac817bc pkgrel=1 pkgdesc='Downloader of videos from YouTube and many other sites (git)' arch=(all) url=https://github.com/yt-dlp/yt-dlp license=(Unlicense) depends=('python3' 'python3-certifi' 'python3-requests' 'python3-urllib3') # missing makedependency python3-editables # https://packages.debian.org/sid/all/python3-editables/download makedepends=('pandoc' 'python3-build' 'python3-editables' 'python3-hatchling' 'python3-installer' 'git') # slow and fails checkdepends=(python3-pytest) #optcheckdepends=('python3-requests' 'python3-websockets') optdepends=('ffmpeg: for video post-processing' 'rtmpdump: for rtmp streams support' 'atomicparsley: for embedding thumbnails into m4a files' 'aria2: for using aria2 as external downloader' 'wget: external downloader (alternative)' 'curl: external downloader (alternative)' 'ca-certificates: SSL cerificates' 'libfribidi-bin: for bidirectional scripts' 'bidiv: for bidirectional scripts (alternative)' 'python3-mutagen: for embedding thumbnail in certain formats' 'python3-pycryptodome-fix: fix packaging bug in debian' 'python3-pycryptodome: for decrypting AES-128 HLS streams and various other data' # 'python3-pycryptodomex: for decrypting AES-128 HLS streams and various other data (alternative)' 'python3-websockets: for downloading over websocket' 'python3-brotli: brotli content encoding support' 'python3-brotlicffi: brotli content encoding support' 'python3-xattr: for writing xattr metadata' 'python3-pyxattr: for writing xattr metadata (alternative)' 'phantomjs: for extractors with javascript code' 'python3-secretstorage: For -cookies-from-browser to access the GNOME keyring while decrypting cookies of Chromium-based browsers') provides=("${pkgname%-git}") conflicts=("${pkgname%-git}") source=(git+"${url}".git) sha256sums=('SKIP') pkgver() { cd "$srcdir/${_pkgname}" printf "%s.r%s.%s" "$(grep __version__ "yt_dlp/version.py" | cut -d \' -f 2 )" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" } prepare() { # Clean out old wheels etc. git -C "${_pkgname}" clean -dfx cd "$srcdir/${_pkgname}" # Debianize folders sed -i 's!share/zsh/site-functions/_yt-dlp!share/zsh/vendor-completions/_yt-dlp!' pyproject.toml sed -i 's!share/doc/yt_dlp/README.txt!share/doc/yt-dlp/README.txt!' pyproject.toml # don't have full git commit history sed -i 's!pypi-files: AUTHORS!pypi-files:!' Makefile } build() { cd "${_pkgname}" make pypi-files lazy-extractors python3 -m build --wheel --no-isolation } # slow and fails check() { cd "${_pkgname}" # remove -Werror and "|| true" for strict test python3 -m pytest -v -Werror -m "not download" || true } package() { cd "${_pkgname}" python3 -m installer --destdir="$pkgdir" dist/*.whl #--optimize=1 --skip-build # Manual remove local mv "$pkgdir/usr/local/"* "$pkgdir/usr/" rmdir "$pkgdir/usr/local" # doc install -Dm644 LICENSE "$pkgdir/usr/share/doc/${_pkgname}/" install -Dm644 Changelog.md "$pkgdir/usr/share/doc/${_pkgname}/changelog" install -Dm644 CONTRIBUTORS "$pkgdir/usr/share/doc/${_pkgname}/" gzip "$pkgdir/usr/share/doc/${_pkgname}/changelog" }