Package Details: python-vcrpy-git 4.1.1.r1006.c79a06f-1

Git Clone URL: https://aur.archlinux.org/python-vcrpy-git.git (read-only, click to copy)
Package Base: python-vcrpy-git
Description: VCR.py simplifies and speeds up tests that make HTTP requests.
Upstream URL: https://github.com/kevin1024/vcrpy
Licenses: MIT
Conflicts: python-vcrpy
Provides: python-vcrpy
Submitter: DanielNak
Maintainer: DanielNak
Last Packager: DanielNak
Votes: 0
Popularity: 0.000000
First Submitted: 2018-12-21 17:09 (UTC)
Last Updated: 2022-03-02 23:02 (UTC)

Dependencies (3)

Required by (5)

Sources (1)

Latest Comments

gesh commented on 2025-01-22 18:06 (UTC)

prepare() is eyebrow-raising. Firstly, VCS packages usually package a "nightly" release -- I would expect this package to be tracking master, not the latest release. Further, instead of doing the checkout manually, you could instead append #tag=$_latest_release (with _latest_release computed as currently) to the source URL to have makepkg do the checkout for you (I don't recommend it, but it's better than the status quo).

Next, pkgver() can be dramatically simplified, given upstream tags their releases properly -- it suffices to use

git describe --tags --long | sed  's/^[^0-9]*//;s/\([^-]*-g\)/r\1/;s/-/./g'

Also, please use PEP517 builds, as explained in wiki.

Finally, and most significantly, you're missing a bunch of the dependencies -- see setup.py for details. (I'll skip adding the tests, given this is already getting long)

The below fixes these (and also adds =$pkgver to provides as explained in https://gitlab.archlinux.org/pacman/namcap/-/issues/96)

diff --git a/PKGBUILD b/PKGBUILD
index 201a876..dcb90ab 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,34 +1,35 @@
 # Maintainer: DanielNak <daniel@tee.cat>
 # Python package author: Kevin McCarthy <me@kevinmccarthy.org>

-_pkgname=vcrpy
+pkgname=python-vcrpy-git
+_pkgname="${pkgname#python-}"
+_pkgname="${_pkgname%-git}"
 _author=kevin1024
-pkgname=python-$_pkgname-git
-pkgver=4.1.1.r1006.c79a06f
+pkgver=7.0.0.r24.g8217a4c
 pkgrel=1
-pkgdesc="VCR.py simplifies and speeds up tests that make HTTP requests."
+pkgdesc="Simplify and speed up tests that make HTTP requests"
 arch=('any')
 url="https://github.com/$_author/$_pkgname"
 license=('MIT')
-depends=('python')
-makedepends=('git' 'python-setuptools')
-provides=("python-$_pkgname")
+depends=('python' 'python-pyyaml' 'python-wrapt' 'python-yarl')
+makedepends=('git' 'python-build' 'python-installer' 'python-wheel' 'python-setuptools')
+provides=("python-$_pkgname=$pkgver")
 conflicts=("python-$_pkgname")
 source=("git+https://github.com/$_author/$_pkgname.git")
-md5sums=('SKIP')
+sha256sums=('SKIP')

-prepare() {
-  cd "$_pkgname"
-  git checkout $(curl https://api.github.com/repos/$_author/$_pkgname/releases | grep tag_name | cut -d '"' -f4 | head -n 1)
+pkgver() {
+    cd "$_pkgname"
+    git describe --tags --long | sed 's/^[^0-9]*//;s/\([^-]*-g\)/r\1/;s/-/./g'
 }

-pkgver() {
-  cd "$_pkgname"
-  printf "%s.r%s.%s" "$(cat vcr/__init__.py | grep -i version | grep -v '#' | cut -d '"' -f2 | head -n 1)" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
+build() {
+    cd "$_pkgname"
+    python -m build --wheel --no-isolation
 }

 package() {
-  cd "$_pkgname"
-  python setup.py install --root="${pkgdir}/" --optimize=1
-  install -Dm644 LICENSE* "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+    cd "$_pkgname"
+    python -m installer --destdir="$pkgdir" dist/*.whl
+    install -Dm644 LICENSE* -t "$pkgdir/usr/share/licenses/$pkgname/"
 }