# shellcheck shell=bash disable=SC2034
# Maintainer: Antonio Rojas <arojas@archlinux.org>

#Included in Slint by Didier Spaier didieratslintdotfr
pkgname=yt-dlp-ejs
pkgver=0.8.0
pkgrel=1slint
export srcname=ejs
slackdesc="$pkgname (External JavaScript for yt-dlp supporting many runtimes)"
url='https://github.com/yt-dlp/ejs'
license=(Unlicense)
depends=(deno
         python)
makedepends=(nodejs
             python-build
             python-hatchling
             python-installer)
checkdepends=(python-pytest)
source=("https://github.com/yt-dlp/ejs/archive/refs/tags/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha256sums=('2704dfcac899fcb443d3b80cb8bb6337c5eb98d09ebf0760295d1c58e9461e53')
docs=("LICENSE" "README.md")
build() {
  cd "$SRC/$srcname-$pkgver" || return 1
  sed -i '/"hatch-vcs"/d' pyproject.toml
  sed -i "s/dynamic = \\[\"version\"\\]/version = \"$pkgver\"/" pyproject.toml
  sed -i '/^\[tool\.hatch\.version\]/,/^$/d' pyproject.toml
  sed -i '/^\[tool\.hatch\.build\.hooks\.vcs\]/,/^$/d' pyproject.toml
  sed -i '/3\.14/d' pyproject.toml
  sed -i '/3\.13/d' pyproject.toml
  python3.11 -m build --wheel --no-isolation
  python3.11 -m installer --destdir="$PKG" dist/*.whl
}
