mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 08:55:07 +03:00
+yt-dlp
This commit is contained in:
parent
3ee665ea28
commit
ff39cb3942
3 changed files with 83 additions and 0 deletions
30
projects/yt-dlp.org/package.yml
Normal file
30
projects/yt-dlp.org/package.yml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
distributable:
|
||||||
|
url: https://github.com/yt-dlp/yt-dlp/releases/download/{{version}}/yt-dlp.tar.gz
|
||||||
|
strip-components: 1
|
||||||
|
|
||||||
|
#NOTE copy-pasta from mesonbuild.com
|
||||||
|
#TODO make a brewkit/ script to do this automatically
|
||||||
|
|
||||||
|
versions:
|
||||||
|
github: yt-dlp/yt-dlp
|
||||||
|
strip: /^yt-dlp /
|
||||||
|
|
||||||
|
dependencies:
|
||||||
|
python.org: 3
|
||||||
|
gnu.org/bash: '>=2' # for our venv/relocation scripts: feel free to fix that
|
||||||
|
|
||||||
|
build:
|
||||||
|
script: |
|
||||||
|
export VERSION={{version}}
|
||||||
|
export PREFIX={{prefix}}
|
||||||
|
export PYTHON_VERSION={{deps.python.org.version}}
|
||||||
|
export PYTHON_VERSION_MAJ={{deps.python.org.version.major}}
|
||||||
|
export PYTHON_VERSION_MIN={{deps.python.org.version.minor}}
|
||||||
|
"$SRCROOT"/props/python-venv.sh yt-dlp yt-dlp.com
|
||||||
|
|
||||||
|
|
||||||
|
test: |
|
||||||
|
yt-dlp --simulate https://youtu.be/pOtd1cbOP7k
|
||||||
|
|
||||||
|
provides:
|
||||||
|
- bin/yt-dlp
|
42
projects/yt-dlp.org/python-venv.sh
Executable file
42
projects/yt-dlp.org/python-venv.sh
Executable file
|
@ -0,0 +1,42 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
CMD_NAME=$1
|
||||||
|
PROJECT_NAME=$2
|
||||||
|
|
||||||
|
python -m venv $PREFIX/libexec
|
||||||
|
|
||||||
|
cd "$PREFIX"
|
||||||
|
|
||||||
|
libexec/bin/pip install -v --no-deps --no-binary :all: --ignore-installed $CMD_NAME
|
||||||
|
mkdir bin
|
||||||
|
|
||||||
|
mv libexec/bin/$CMD_NAME libexec/bin/$CMD_NAME.py
|
||||||
|
|
||||||
|
cd bin
|
||||||
|
ln -s ../libexec/bin/$CMD_NAME $CMD_NAME
|
||||||
|
|
||||||
|
cd ../libexec/bin
|
||||||
|
fix-shebangs.ts *
|
||||||
|
|
||||||
|
cp "$SRCROOT"/props/shim.bash $CMD_NAME
|
||||||
|
chmod +x $CMD_NAME
|
||||||
|
|
||||||
|
rm Activate.ps1 activate.csh activate.fish
|
||||||
|
|
||||||
|
sed -i.bak 's|VIRTUAL_ENV=".*"|VIRTUAL_ENV="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. \&\& pwd)"|' activate
|
||||||
|
rm activate.bak
|
||||||
|
|
||||||
|
# FIXME a lot: this "updates" the `venv` on each run for relocatability
|
||||||
|
cat <<EOF>>activate
|
||||||
|
|
||||||
|
sed -i.bak \\
|
||||||
|
-e "s|$TEA_PREFIX/python.org/v$PYTHON_VERSION|\$TEA_PREFIX/python.org/v$PYTHON_VERSION_MAJ|" \\
|
||||||
|
-e 's|bin/python$PYTHON_VERSION_MAJ.$PYTHON_VERSION_MIN|bin/python|' \\
|
||||||
|
-e "s|$PREFIX/libexec|\$TEA_PREFIX/$PROJECT_NAME/v$VERSION/libexec|" \\
|
||||||
|
\$VIRTUAL_ENV/pyvenv.cfg
|
||||||
|
rm \$VIRTUAL_ENV/pyvenv.cfg.bak
|
||||||
|
EOF
|
||||||
|
|
||||||
|
for x in python*; do
|
||||||
|
ln -sf ../../../../python.org/v$PYTHON_VERSION_MAJ/bin/$x $x
|
||||||
|
done
|
11
projects/yt-dlp.org/shim.bash
Executable file
11
projects/yt-dlp.org/shim.bash
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
self="${BASH_SOURCE[0]}"
|
||||||
|
if test -L "$self"; then
|
||||||
|
prefix="$(dirname "$self")"
|
||||||
|
suffix="$(dirname $(readlink $self))"
|
||||||
|
LIBEXEC="$(cd $prefix/$suffix && pwd)"
|
||||||
|
else
|
||||||
|
LIBEXEC="$(cd "$(dirname "$self")" && pwd)"
|
||||||
|
fi
|
||||||
|
source "$LIBEXEC/activate"
|
||||||
|
exec "$LIBEXEC"/yt-dlp.py "$@"
|
Loading…
Reference in a new issue