summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@parabola.nu>2022-09-26 17:52:54 -0600
committerLuke T. Shumaker <lukeshu@parabola.nu>2024-01-08 10:31:43 -0700
commit927f1eb2952f77b69cb14e6240bb01d59794924e (patch)
tree21aa3f4a20a4108e6b174661ef151bbf40d07706 /pcr
parent2d87219c0bdb473e079862fac98f7563088b8e55 (diff)
pcr/python-pyspf: Build for newer Python, clean up
Diffstat (limited to 'pcr')
-rw-r--r--pcr/python-pyspf/PKGBUILD80
1 files changed, 17 insertions, 63 deletions
diff --git a/pcr/python-pyspf/PKGBUILD b/pcr/python-pyspf/PKGBUILD
index 76a864f62..13376cc9a 100644
--- a/pcr/python-pyspf/PKGBUILD
+++ b/pcr/python-pyspf/PKGBUILD
@@ -4,82 +4,36 @@
# Contributor: Samed Beyribey <ras0ir AT eventualis DOT org>
pkgname=python-pyspf
+_pkgname=${pkgname#python-}
pkgver=2.0.14
-pkgrel=2
+pkgrel=3
pkgdesc="Python implementation of the Sender Policy Framework (SPF) protocol"
arch=('any')
-url="https://pypi.python.org/pypi/pyspf"
+url="https://pypi.python.org/pypi/${_pkgname}"
license=('PSF')
-makedepends=('python-setuptools')
-depends=('python-py3dns' 'python')
+makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
+depends=('python-py3dns')
+checkdepends=('python-yaml' 'python-authres')
optdepends=('python-authres: Return RFC 5451 Authentication Results headers')
-source=("https://files.pythonhosted.org/packages/d4/dc/5b3838ff90474e21fe0914920c53430f73402e07d6598ea228e61b74963e/pyspf-$pkgver.tar.gz")
+source=("https://files.pythonhosted.org/packages/d4/dc/5b3838ff90474e21fe0914920c53430f73402e07d6598ea228e61b74963e/${_pkgname}-$pkgver.tar.gz")
sha256sums=('57a7ef01bda090173aafb6af0106251686ed73f03db4e911fcd34c57fc347186')
-
-_version_constraint() # (dep_pkgname [precision])
-{
- Log() { [[ "${FUNCNAME[2]}" == package ]] && echo "$@" >&2 || : ; }
-
-
- local dep_pkgname=$1
- declare -i req_precision=$2
- local full_version=$(pacman -S --print-format='%v' ${dep_pkgname} 2> /dev/null | tail -n 1)
- local n_dots=$(tmp=${full_version%-*} ; tmp=${tmp//[^\.]} ; echo "${#tmp}" ;)
- local def_precision=$(( n_dots + 1 ))
- local is_prec_valid=$(( req_precision > 0 && req_precision <= def_precision ))
- local precision=$((( is_prec_valid )) && echo ${req_precision} || echo ${def_precision})
- local pkgver_rx='[0-9A-Za-z_]+'
- pkgver_rx=$(sed 's|\]|\+]|' <<<${pkgver_rx}) # according to the wiki, '+' is not allowed,
- # but some pkgver have it (eg: 5.15.10+kde+r130)
- local subver_rx='\.'${pkgver_rx}
- local pkgrel_rx='[0-9]+'
- local garbage_rx='[^0-9].*'
- local capture_rx=${pkgver_rx}
- for (( n_dots=1 ; n_dots < precision ; ++n_dots )) ; do capture_rx+=${subver_rx} ; done ;
- local version pkgrel has_dot_char version_min version_max constraint_string
- declare -i subver subver_inc pkgrel_inc
-
- if [[ "${full_version}" =~ ^(${capture_rx})(${subver_rx})*-(${pkgrel_rx}).*$ ]]
- then version=${BASH_REMATCH[1]} # pkgver cut to the requested precision
- #unused=${BASH_REMATCH[2]} # discarded pkgver segments
- pkgrel=${BASH_REMATCH[3]} # pkgrel with non-numerics right-trimmed
- has_dot_char=$([[ "${version}" =~ \. ]] ; echo $(( ! $? )) ; )
- subver=$(sed "s|${garbage_rx}||" <<<${version##*.}) # right-trim from any non-numeric
- version=$( (( has_dot_char )) && echo ${version%.*}.${subver} || echo ${subver} )
- subver_inc=$(( subver + 1 ))
- pkgrel_inc=$(( pkgrel + 1 ))
- version_min=$( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel} || \
- echo ${version} )
- version_max=$( ( (( ! is_prec_valid )) && echo ${full_version%-*}-${pkgrel_inc} ) || \
- ( [[ "${version}" =~ \. ]] && echo ${version%.*}.${subver_inc} ) || \
- echo ${subver_inc} )
- constraint_string="${dep_pkgname}>=${version_min} ${dep_pkgname}<${version_max}"
-
- Log "Applied version constraint: '${constraint_string}'"
- else Log "ERROR: in _version_constraint() parsing: dep_pkgname='${dep_pkgname}' full_version='${full_version}'"
- exit 1
- fi
-
- unset -f Log
-
- echo -n "${constraint_string}"
-}
-
-
build() {
- cd "$srcdir/pyspf-$pkgver"
+ cd "$_pkgname-$pkgver"
+ python -m build --wheel --no-isolation
+}
- python setup.py build
+check() {
+ cd "$_pkgname-$pkgver/test"
+ PYTHONPATH=../build/lib python testspf.py
}
package() {
- # pin to strongly-coupled dependency versions
- depends=( ${depends[*]/python/} $(_version_constraint python 2) )
-
- cd "$srcdir/pyspf-$pkgver"
+ _python_version=$(pacman -S --print-format='%v' python|cut -d- -f1|cut -d. -f1,2)
+ depends+=("python>=${_python_version}" "python<${_python_version%.*}.$(( ${_python_version##*.} + 1 ))")
- python setup.py install --root="$pkgdir" --optimize=1
+ cd "$_pkgname-$pkgver"
+ python -m installer --destdir="$pkgdir" dist/*.whl
}