Commit 2c2f262088
Unsigned
Layout: unified · split
PKGBUILD +33 −12
| @@ -1,29 +1,43 @@ | ||
| 1 | 1 | # Maintainer: Wraient <rushikeshwastaken@gmail.com> |
| 2 | 2 | pkgname='curd' |
| 3 | pkgver='r86.2ccc8b0' | |
| 4 | pkgrel=1 | |
| 3 | pkgver=r92.d2c2c15 | |
| 4 | pkgrel=5 | |
| 5 | 5 | pkgdesc="Watch anime in cli with Anilist Tracking, Discord RPC, Intro Outro Skipping, etc." |
| 6 | 6 | arch=("x86_64") |
| 7 | 7 | url="https://github.com/Wraient/curd" |
| 8 | 8 | license=('GPL') |
| 9 | 9 | depends=('python' 'mpv' 'socat') |
| 10 | makedepends=('python-pip') | |
| 11 | source=("https://raw.githubusercontent.com/Wraient/curd/refs/heads/main/curd.py") | |
| 10 | makedepends=('git' 'python-pip') | |
| 11 | source=("git+$url.git") | |
| 12 | 12 | sha256sums=('SKIP') |
| 13 | 13 | |
| 14 | pkgver() { | |
| 15 | cd "$srcdir/$pkgname" | |
| 16 | # Use the number of commits and the short hash as the version number | |
| 17 | printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" | |
| 18 | } | |
| 19 | ||
| 20 | build() { | |
| 21 | # No compilation needed for a Python script | |
| 22 | return 0 | |
| 23 | } | |
| 24 | ||
| 14 | 25 | package() { |
| 15 | # Create the directory for the virtual environment | |
| 16 | install -dm755 "$pkgdir/usr/share/curd" | |
| 26 | # Create the directory for the virtual environment and script | |
| 27 | install -dm755 "$pkgdir/usr/share/$pkgname" | |
| 17 | 28 | |
| 18 | # Create a virtual environment | |
| 19 | python -m venv "$pkgdir/usr/share/curd/venv" | |
| 29 | # Check if the virtual environment already exists, if not, create it | |
| 30 | if [ ! -d "$pkgdir/usr/share/$pkgname/venv" ]; then | |
| 31 | python -m venv "$pkgdir/usr/share/$pkgname/venv" | |
| 32 | fi | |
| 20 | 33 | |
| 21 | # Install pypresence in the virtual environment | |
| 22 | "$pkgdir/usr/share/curd/venv/bin/pip" install pypresence requests | |
| 34 | # Install or update packages in the virtual environment | |
| 35 | "$pkgdir/usr/share/$pkgname/venv/bin/pip" install --upgrade pypresence requests | |
| 23 | 36 | |
| 24 | 37 | # Install the Python script |
| 25 | install -Dm755 "$srcdir/curd.py" "$pkgdir/usr/bin/curd.py" | |
| 38 | install -Dm755 "$srcdir/$pkgname/curd.py" "$pkgdir/usr/share/$pkgname/curd.py" | |
| 26 | 39 | |
| 40 | install -Dm755 /dev/null "$pkgdir/usr/bin/curd" | |
| 27 | 41 | # Create the run script |
| 28 | 42 | cat << 'EOF' > "$pkgdir/usr/bin/curd" |
| 29 | 43 | #!/bin/bash |
| @@ -31,11 +45,17 @@ package() { | ||
| 31 | 45 | # Path to the virtual environment |
| 32 | 46 | VENV_DIR="/usr/share/curd/venv" |
| 33 | 47 | |
| 48 | # Check if the virtual environment exists, create if not | |
| 49 | if [ ! -d "$VENV_DIR" ]; then | |
| 50 | python -m venv "$VENV_DIR" | |
| 51 | "$VENV_DIR/bin/pip" install pypresence requests | |
| 52 | fi | |
| 53 | ||
| 34 | 54 | # Activate the virtual environment |
| 35 | 55 | source "$VENV_DIR/bin/activate" |
| 36 | 56 | |
| 37 | 57 | # Run the Python script |
| 38 | python /usr/bin/curd.py | |
| 58 | python /usr/share/curd/curd.py "$@" | |
| 39 | 59 | |
| 40 | 60 | # Deactivate the virtual environment after running |
| 41 | 61 | deactivate |
| @@ -44,3 +64,4 @@ EOF | ||
| 44 | 64 | # Make the run script executable |
| 45 | 65 | chmod +x "$pkgdir/usr/bin/curd" |
| 46 | 66 | } |
| 67 | ||