mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-06 15:08:57 +02:00
yt_dlp and youtube_dl: cleanup recipes. (#11856)
This gets rid of the `yt_dlp` vs `yt_dlp_python310` and `youtube_dl` vs `youtube_dl_python310` distinction. We only need one of each (as there's really no need to have, say, `yt_dlp` packages for more than one Python version. This also switches `/bin/yt-dlp` (and `/bin/youtube-dl`) from a "standalone" program (they were "pyinstaller" bundles), into a small wrapper script that calls yt_dlp's entry point from the Python module installed under vendor-packages. Using the "standalone" version stopped making much sense once the `request_python310` "optional dependency" was added to the recipe.
This commit is contained in:
@@ -9,13 +9,16 @@ HOMEPAGE="https://ytdl-org.github.io/youtube-dl/index.html
|
|||||||
https://github.com/ytdl-org/youtube-dl"
|
https://github.com/ytdl-org/youtube-dl"
|
||||||
COPYRIGHT="2006-2021 youtube-dl contributors"
|
COPYRIGHT="2006-2021 youtube-dl contributors"
|
||||||
LICENSE="Unlicense"
|
LICENSE="Unlicense"
|
||||||
REVISION="4"
|
REVISION="5"
|
||||||
SOURCE_URI="https://github.com/ytdl-org/youtube-dl/releases/download/$portVersion/youtube-dl-$portVersion.tar.gz"
|
SOURCE_URI="https://github.com/ytdl-org/youtube-dl/releases/download/$portVersion/youtube-dl-$portVersion.tar.gz"
|
||||||
CHECKSUM_SHA256="9f3b99c8b778455165b4525f21505e86c7ff565f3ac319e19733d810194135df"
|
CHECKSUM_SHA256="9f3b99c8b778455165b4525f21505e86c7ff565f3ac319e19733d810194135df"
|
||||||
SOURCE_DIR="youtube-dl"
|
SOURCE_DIR="youtube-dl"
|
||||||
|
|
||||||
ARCHITECTURES="any"
|
ARCHITECTURES="any"
|
||||||
|
|
||||||
|
pythonVersion=3.10
|
||||||
|
pythonPackage=python${pythonVersion//.}
|
||||||
|
|
||||||
PROVIDES="
|
PROVIDES="
|
||||||
youtube_dl = $portVersion
|
youtube_dl = $portVersion
|
||||||
cmd:youtube_dl = $portVersion
|
cmd:youtube_dl = $portVersion
|
||||||
@@ -23,82 +26,51 @@ PROVIDES="
|
|||||||
REQUIRES="
|
REQUIRES="
|
||||||
haiku
|
haiku
|
||||||
ffmpeg6_tools
|
ffmpeg6_tools
|
||||||
cmd:python3
|
cmd:python$pythonVersion
|
||||||
|
"
|
||||||
|
|
||||||
|
# This recipe was previously built as if it was just a regular Python package recipe,
|
||||||
|
# and not as a CLI program that targets a particular Python version.
|
||||||
|
REPLACES="
|
||||||
|
youtube_dl_python310
|
||||||
"
|
"
|
||||||
|
|
||||||
BUILD_REQUIRES="
|
BUILD_REQUIRES="
|
||||||
haiku_devel
|
haiku_devel
|
||||||
|
setuptools_$pythonPackage
|
||||||
"
|
"
|
||||||
BUILD_PREREQUIRES="
|
BUILD_PREREQUIRES="
|
||||||
cmd:find
|
cmd:find
|
||||||
cmd:make
|
cmd:make
|
||||||
|
cmd:python$pythonVersion
|
||||||
cmd:zip
|
cmd:zip
|
||||||
"
|
"
|
||||||
|
|
||||||
PYTHON_PACKAGES=(python310)
|
|
||||||
PYTHON_VERSIONS=(3.10)
|
|
||||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
|
||||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
|
||||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
||||||
eval "\
|
|
||||||
PROVIDES_${pythonPackage}=\"\n\
|
|
||||||
${portName}_$pythonPackage = $portVersion\n\
|
|
||||||
cmd:youtube_dl_$pythonPackage = $portVersion\n\
|
|
||||||
\"; \
|
|
||||||
REQUIRES_$pythonPackage=\"\n\
|
|
||||||
haiku\n\
|
|
||||||
cmd:python$pythonVersion\n\
|
|
||||||
\"\
|
|
||||||
"
|
|
||||||
|
|
||||||
BUILD_REQUIRES="$BUILD_REQUIRES
|
|
||||||
setuptools_$pythonPackage
|
|
||||||
"
|
|
||||||
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
|
|
||||||
cmd:python$pythonVersion
|
|
||||||
"
|
|
||||||
done
|
|
||||||
|
|
||||||
INSTALL()
|
INSTALL()
|
||||||
{
|
{
|
||||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
|
||||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
|
||||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
||||||
|
|
||||||
python=python$pythonVersion
|
python=python$pythonVersion
|
||||||
installLocation="$prefix"/lib/$python/vendor-packages/
|
installLocation="$prefix"/lib/$python/vendor-packages/
|
||||||
export PYTHONPATH="$installLocation"
|
export PYTHONPATH="$installLocation"
|
||||||
rm -rf build
|
|
||||||
mkdir -p "$installLocation"
|
mkdir -p "$installLocation"
|
||||||
$python setup.py build install --root=/ --prefix="$prefix"
|
$python setup.py build install --root=/ --prefix="$prefix"
|
||||||
|
|
||||||
rm -rf "$prefix"/share/man
|
# Install shell completions:
|
||||||
mv "$binDir"/youtube-dl "$binDir"/youtube-dl-$pythonPackage
|
install -d $dataDir/bash-completion/completions
|
||||||
packageEntries $pythonPackage \
|
cp youtube-dl.bash-completion $dataDir/bash-completion/completions/youtube-dl
|
||||||
"$prefix"/lib/$python \
|
install -d $dataDir/fish
|
||||||
"$binDir"/youtube-dl-$pythonPackage
|
cp youtube-dl.fish $dataDir/fish/
|
||||||
|
install -d $dataDir/zsh/site-functions
|
||||||
|
cp youtube-dl.zsh $dataDir/zsh/site-functions/_youtube-dl
|
||||||
|
|
||||||
# Avoid interference between the different python versions, clean any
|
# Install man page and Readme:
|
||||||
# temporary files. Don't use "make clean" because it also removes
|
mkdir -p $docDir $manDir
|
||||||
# things that we are not able to rebuild (docs need pandoc, for example)
|
mv $prefix/share/man/man1 $manDir
|
||||||
rm youtube-dl
|
mv $prefix/share/doc/youtube_dl/README.txt $docDir
|
||||||
done
|
|
||||||
|
|
||||||
make install PREFIX="$prefix" MANDIR="$manDir" SHAREDIR="$dataDir" \
|
# Remove left over cruft:
|
||||||
PYTHON="/system/bin/python3"
|
rm -rf $prefix/etc
|
||||||
install -d "$dataDir"/bash-completion "$docDir"
|
rm -rf $prefix/share
|
||||||
mv "$prefix"/share/doc/youtube_dl/README.txt "$docDir"
|
|
||||||
|
|
||||||
# We now have two identical files in $prefix/etc/bash_completion.d/
|
|
||||||
# Let's drop "youtube-dl.bash-completion" and keep "youtube-dl".
|
|
||||||
rm -f "$prefix"/etc/bash_completion.d/youtube-dl.bash-completion
|
|
||||||
|
|
||||||
# We need "youtube-dl" in "$dataDir/bash-completion/completions/".
|
|
||||||
mv "$prefix"/etc/bash_completion.d "$dataDir"/bash-completion/completions
|
|
||||||
|
|
||||||
mv "$prefix"/etc/fish "$dataDir"
|
|
||||||
cd "$prefix"
|
|
||||||
rmdir -p etc share/doc/youtube_dl
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST()
|
TEST()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ to download these videos by itself."
|
|||||||
HOMEPAGE="https://github.com/yt-dlp/yt-dlp"
|
HOMEPAGE="https://github.com/yt-dlp/yt-dlp"
|
||||||
COPYRIGHT="2006-2025 youtube-dl and yt-dlp contributors"
|
COPYRIGHT="2006-2025 youtube-dl and yt-dlp contributors"
|
||||||
LICENSE="Unlicense"
|
LICENSE="Unlicense"
|
||||||
REVISION="1"
|
REVISION="2"
|
||||||
SOURCE_URI="https://github.com/yt-dlp/yt-dlp/releases/download/$portVersion/yt-dlp.tar.gz"
|
SOURCE_URI="https://github.com/yt-dlp/yt-dlp/releases/download/$portVersion/yt-dlp.tar.gz"
|
||||||
SOURCE_FILENAME="yt-dlp-$portVersion.tar.gz"
|
SOURCE_FILENAME="yt-dlp-$portVersion.tar.gz"
|
||||||
CHECKSUM_SHA256="28a8c33e4c32bd12e16601180b9f3a43fdc2896ad5467bc6e5a9f1fa6c280e28"
|
CHECKSUM_SHA256="28a8c33e4c32bd12e16601180b9f3a43fdc2896ad5467bc6e5a9f1fa6c280e28"
|
||||||
@@ -17,6 +17,9 @@ SOURCE_DIR="yt-dlp"
|
|||||||
|
|
||||||
ARCHITECTURES="any"
|
ARCHITECTURES="any"
|
||||||
|
|
||||||
|
pythonVersion=3.10
|
||||||
|
pythonPackage=python${pythonVersion//.}
|
||||||
|
|
||||||
PROVIDES="
|
PROVIDES="
|
||||||
yt_dlp = $portVersion
|
yt_dlp = $portVersion
|
||||||
cmd:yt_dlp = $portVersion
|
cmd:yt_dlp = $portVersion
|
||||||
@@ -24,79 +27,64 @@ PROVIDES="
|
|||||||
REQUIRES="
|
REQUIRES="
|
||||||
haiku
|
haiku
|
||||||
ffmpeg6_tools
|
ffmpeg6_tools
|
||||||
cmd:python3
|
cmd:python$pythonVersion
|
||||||
|
# These are listed as optional dependencies in yt_dlp's pyproject.toml:
|
||||||
|
# brotli_$pythonPackage
|
||||||
|
# brotlicffi_$pythonPackage
|
||||||
|
# certifi_$pythonPackage
|
||||||
|
# mutagen_$pythonPackage
|
||||||
|
# pycryptodomex_$pythonPackage
|
||||||
|
requests_$pythonPackage # >=2.32.2,<3
|
||||||
|
# urllib3_$pythonPackage # >=1.26.17,<3
|
||||||
|
# websockets_$pythonPackage # >=13.0
|
||||||
|
"
|
||||||
|
|
||||||
|
# This recipe was previously built as if it was just a regular Python package recipe,
|
||||||
|
# and not as a CLI program that targets a particular Python version.
|
||||||
|
REPLACES="
|
||||||
|
yt_dlp_python310
|
||||||
"
|
"
|
||||||
|
|
||||||
BUILD_REQUIRES="
|
BUILD_REQUIRES="
|
||||||
haiku_devel
|
haiku_devel
|
||||||
"
|
|
||||||
BUILD_PREREQUIRES="
|
|
||||||
cmd:find
|
|
||||||
cmd:make
|
|
||||||
cmd:zip
|
|
||||||
"
|
|
||||||
|
|
||||||
PYTHON_PACKAGES=(python310)
|
|
||||||
PYTHON_VERSIONS=(3.10)
|
|
||||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
|
||||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
|
||||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
||||||
eval "\
|
|
||||||
PROVIDES_${pythonPackage}=\"\n\
|
|
||||||
${portName}_$pythonPackage = $portVersion\n\
|
|
||||||
cmd:yt_dlp_$pythonPackage = $portVersion\n\
|
|
||||||
\"; \
|
|
||||||
REQUIRES_$pythonPackage=\"\n\
|
|
||||||
haiku\n\
|
|
||||||
cmd:python$pythonVersion\n\
|
|
||||||
requests_$pythonPackage\n\
|
|
||||||
\"\
|
|
||||||
"
|
|
||||||
|
|
||||||
BUILD_REQUIRES="$BUILD_REQUIRES
|
|
||||||
build_$pythonPackage
|
build_$pythonPackage
|
||||||
hatchling_$pythonPackage
|
hatchling_$pythonPackage
|
||||||
installer_$pythonPackage
|
installer_$pythonPackage
|
||||||
"
|
"
|
||||||
BUILD_PREREQUIRES="$BUILD_PREREQUIRES
|
BUILD_PREREQUIRES="
|
||||||
|
cmd:find
|
||||||
|
cmd:make
|
||||||
cmd:python$pythonVersion
|
cmd:python$pythonVersion
|
||||||
|
cmd:zip
|
||||||
"
|
"
|
||||||
TEST_REQUIRES="
|
TEST_REQUIRES="
|
||||||
pytest_$pythonPackage
|
pytest_$pythonPackage
|
||||||
"
|
"
|
||||||
done
|
|
||||||
|
BUILD()
|
||||||
|
{
|
||||||
|
python$pythonVersion -m build --wheel --skip-dependency-check --no-isolation
|
||||||
|
}
|
||||||
|
|
||||||
INSTALL()
|
INSTALL()
|
||||||
{
|
{
|
||||||
for i in "${!PYTHON_PACKAGES[@]}"; do
|
python$pythonVersion -m installer -p $prefix dist/*.whl
|
||||||
pythonPackage=${PYTHON_PACKAGES[i]}
|
|
||||||
pythonVersion=${PYTHON_VERSIONS[$i]}
|
|
||||||
|
|
||||||
python=python$pythonVersion
|
# Install shell completions:
|
||||||
installLocation="$prefix"/lib/$python/vendor-packages/
|
mv $prefix/share/bash-completion $dataDir
|
||||||
export PYTHONPATH="$installLocation"
|
mv $prefix/share/fish $dataDir
|
||||||
rm -rf build
|
mv $prefix/share/zsh $dataDir
|
||||||
mkdir -p "$installLocation"
|
|
||||||
$python -m build --wheel --no-isolation
|
|
||||||
$python -m installer -p $prefix dist/*.whl
|
|
||||||
|
|
||||||
rm -rf "$prefix"/share/man
|
# Install man page and Readme:
|
||||||
mv "$binDir"/yt-dlp "$binDir"/yt-dlp-$pythonPackage
|
mkdir -p $docDir $manDir
|
||||||
packageEntries $pythonPackage \
|
mv $prefix/share/man/man1 $manDir
|
||||||
"$prefix"/lib/$python \
|
mv $prefix/share/doc/yt_dlp/README.txt $docDir
|
||||||
"$binDir"/yt-dlp-$pythonPackage
|
|
||||||
done
|
|
||||||
|
|
||||||
make install PREFIX="$prefix" MANDIR="$manDir" SHAREDIR="$dataDir" \
|
# Remove left over cruft:
|
||||||
PYTHON="/system/bin/python3" BINDIR="$binDir" DESTDIR=
|
rm -rf $prefix/share
|
||||||
|
|
||||||
install -d "$dataDir"/bash-completion "$docDir"
|
|
||||||
mv "$prefix"/share/doc/yt_dlp/README.txt "$docDir"
|
|
||||||
|
|
||||||
rm -rf "$prefix"/etc "$prefix"/share
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST()
|
TEST()
|
||||||
{
|
{
|
||||||
pytest-3.10 -v -m "not download"
|
pytest-$pythonVersion -v -m "not download"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user