psykose deb62258ec */*: set --skip-build for python installs
this marginally increases install speed by not checking if it needs a rebuild.
also remove --prefix=/usr as it defaults to /usr already.

might break a build or two, will fix later
2023-01-10 04:19:31 +01:00

80 lines
2.7 KiB
Plaintext

# Contributor: Henrik Riomar <henrik.riomar@gmail.com>
# Maintainer: Henrik Riomar <henrik.riomar@gmail.com>
pkgname=py3-pkcs11
_pkgname=python-pkcs11
pkgver=0.7.0
pkgrel=3
pkgdesc="PKCS#11/Cryptoki support for Python"
url="https://github.com/danni/python-pkcs11"
arch="all"
license="MIT"
checkdepends="
py3-oscrypto
py3-pytest
softhsm
"
makedepends="
cython
py3-setuptools_scm
python3-dev
"
depends="
py3-asn1crypto
py3-cached-property
py3-cryptography
python3
"
source="
https://github.com/danni/python-pkcs11/archive/v$pkgver/$_pkgname-$pkgver.tar.gz
0001-test_x509-add-tzinfo-to-not_before-and-not_after-dat.patch
0002-KeyType.EC_EDWARDS-in-test_sign_eddsa.patch
0003-test_generate_params-use-size-1024.patch
0004-tests-test_x509.py-disable-openssl-verify-test.patch
"
builddir="$srcdir/$_pkgname-$pkgver"
build() {
export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
python3 setup.py build
}
check() {
# setup softhsm for tests
tokendir=$(mktemp -d "$builddir/token.XXXXXX")
conffile=$(mktemp "$builddir/conf.XXXXXX")
cat > "$conffile" << EOF
directories.tokendir = $tokendir
objectstore.backend = file
EOF
export SOFTHSM2_CONF=$conffile
softhsm2-util --init-token --free --label pytest --pin 1234 --so-pin 987654321
export PKCS11_TOKEN_LABEL=pytest
export PKCS11_TOKEN_PIN=1234
export PKCS11_TOKEN_SO_PIN=987654321
export PKCS11_MODULE=/usr/lib/softhsm/libsofthsm2.so
# do test installation
export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
python3 setup.py install --root="$builddir"/test_install --skip-build
PYTHONPATH="$(echo "$builddir"/test_install/usr/lib/python3*/site-packages)"
export PYTHONPATH
# run tests
pytest-3 --import-mode=append
}
package() {
export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
python3 setup.py install --skip-build --root="$pkgdir"
}
sha512sums="
af8b300ab012226fbb0427f763f65151e9a1cb5605d62331c88d820c269bfabf7222af542212577e2e4e6c06b4f1c20c1852e53c4bcb25e30846fcda2788ac5f python-pkcs11-0.7.0.tar.gz
ed0bbb955ed96da316158a2e1e75d0284c55151a8534773569ecb3b0c712f54f0eb4eff57c63e6523f749c8e484aa574b6d0614a29ed8e0c39ea9f9b7d075701 0001-test_x509-add-tzinfo-to-not_before-and-not_after-dat.patch
dd8c68ac64438f09d16d11b747ee0a12c57fde779cc4db20fa4422f35280e9b74745ad3a6b676457c91ef78e1a79574dbe7301d69b93fd0bcbca5beac910e950 0002-KeyType.EC_EDWARDS-in-test_sign_eddsa.patch
cb2e6ae12e054d4777a995c7fdd300af822b8969f20c2220a2a1879867c751de735d776e667b56fb01899d71fe147df9cc84ae56006c364c71fba089ea45a8e9 0003-test_generate_params-use-size-1024.patch
a62cf31bcfea83a9acf3522c6be96b2a82a35d188109de1fc1e2f5fe0a910cf82c040ebf330fdf085bf8da0fd33f00fc75c46cfc09c128a5d5171305860dfd27 0004-tests-test_x509.py-disable-openssl-verify-test.patch
"