Commit 2c2f262088

2c2f26208856a7b79b31a8c92196b20b053b7fa7

parent: 14947a0691

Unsigned

Wraient <wraient.911@gmail.com> · 2024-10-11 16:28 UTC

updates pkgbuild

Layout: unified · split

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