summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 54e1efe05a29c9ab271068b2b153ad7d09b5cb95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Maintainer: SaintFore <saintfore@example.com>
pkgname=leetcode-fsrs-cli
pkgver=1.6.6
pkgrel=1
pkgdesc="A CLI tool for LeetCode practice using FSRS spaced repetition algorithm"
arch=('any')
url="https://github.com/SaintFore/LeetCodeCLI"
license=('MIT')
depends=('python' 'python-click' 'python-requests' 'python-scipy' 'python-numpy')
optdepends=('git: for version control integration')
makedepends=('python-setuptools')
provides=('leetcode-fsrs-cli')
conflicts=('leetcode-fsrs-cli')
replaces=('leetcode-fsrs-cli')
backup=('etc/leetcode-fsrs-cli/config.json')

source=("https://github.com/SaintFore/LeetCodeCLI/archive/refs/tags/v$pkgver.tar.gz")
sha256sums=('1e4fd5d6e6bea05002894eb705c203e82f655cb79fbb0ca18939f14e07206c21')

build() {
  cd "LeetCodeCLI-$pkgver"
  python setup.py build
}

package() {
  cd "LeetCodeCLI-$pkgver"
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build

  # Install license
  install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  # Install documentation
  install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"

  # Create configuration directory
  install -d "$pkgdir/etc/leetcode-fsrs-cli"

  # Create user data directory
  install -d "$pkgdir/usr/share/leetcode-fsrs-cli/data"

  # Install default configuration (create empty config if not exists)
  if [ -f data/config.json ]; then
    install -Dm644 data/config.json "$pkgdir/usr/share/leetcode-fsrs-cli/data/config.json"
  else
    mkdir -p "$pkgdir/usr/share/leetcode-fsrs-cli/data"
    echo '{}' > "$pkgdir/usr/share/leetcode-fsrs-cli/data/config.json"
    chmod 644 "$pkgdir/usr/share/leetcode-fsrs-cli/data/config.json"
  fi

  # Create a message about user data location
  install -d "$pkgdir/usr/share/leetcode-fsrs-cli"
  cat > "$pkgdir/usr/share/leetcode-fsrs-cli/INSTALL" << EOF
LeetCode FSRS CLI has been installed!

To get started:
1. Run: leetcode-fsrs init
2. Then: leetcode-fsrs practice

Your data will be stored in: ~/.config/leetcode-fsrs-cli/

For more information, see: leetcode-fsrs --help
EOF
}