git » python-pycurl.git » commit 42c26c4

Remove unneeded prepare() function

author David Runge
2024-04-10 09:10:54 UTC
committer David Runge
2024-04-10 09:10:54 UTC
parent dfeee8d3b9dd999a49842c2cd83a87b852968f1d

Remove unneeded prepare() function

Introduce custom variables to abstract upstream name and version to DRY.

Signed-off-by: David Runge <dvzrv@archlinux.org>

PKGBUILD +6 -8

diff --git a/PKGBUILD b/PKGBUILD
index 072abf4..b5c3e1e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,9 @@
 # Contributor: Angel 'angvp' Velasquez <angvp[at]archlinux.com.ve>
 
 pkgname=python-pycurl
+_name="${pkgname#python-}"
 pkgver=7.45.2
+_version="REL_${pkgver//./_}"
 pkgrel=3
 pkgdesc="A Python 3.x interface to libcurl"
 arch=('x86_64')
@@ -12,15 +14,11 @@ license=('LGPL-2.1-only OR MIT')
 depends=('python' 'curl')
 makedepends=('python-build' 'python-installer' 'python-setuptools' 'python-wheel')
 checkdepends=('python-bottle' 'python-pytest' 'vsftpd' 'python-flaky' 'python-pyflakes')
-source=("https://github.com/pycurl/pycurl/archive/REL_${pkgver//./_}/$pkgname-$pkgver.tar.gz")
+source=("https://github.com/pycurl/pycurl/archive/$_version/$pkgname-$pkgver.tar.gz")
 sha512sums=('c27d500a310124b0972eaeb424afc2878e0cd59bec9841ec0dcff3485a76e78b53438d9bf9c035658058d7c118e3e5ecd426e0733cbd251261135c6a504f2edf')
 
-prepare() {
-  mv pycurl-REL_${pkgver//./_} pycurl-$pkgver
-}
-
 build() {
-  cd pycurl-$pkgver
+  cd $_name-$_version
   # the unified source release builds (see PYCURL_RELEASE=1 in Makefile) do not work with tests
   python -m build --wheel --no-isolation
   # needed for tests
@@ -64,14 +62,14 @@ check() {
     --deselect tests/multi_socket_select_test.py::MultiSocketSelectTest::test_multi_socket_select
   )
 
-  cd pycurl-$pkgver
+  cd $_name-$_version
   python -m installer --destdir=test_dir dist/*.whl
   export PYTHONPATH="$PWD/test_dir/$site_packages:$PYTHONPATH"
   pytest "${pytest_options[@]}"
 }
 
 package() {
-  cd pycurl-$pkgver
+  cd $_name-$_version
   python -m installer --destdir="$pkgdir" dist/*.whl
   install -Dm644 COPYING-MIT -t "$pkgdir"/usr/share/licenses/$pkgname/
 }