86 lines
3.0 KiB
Bash
86 lines
3.0 KiB
Bash
# Maintainer: Manuel Naranjo <naranjo.manuel@gmail.com>
|
|
|
|
_pyname=psutil
|
|
_realname=${_pyname}
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
|
|
provides=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
conflicts=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
replaces=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=5.9.8
|
|
pkgrel=1
|
|
pkgdesc="A cross-platform process and system utilities module for Python (mingw-w64)"
|
|
arch=('any')
|
|
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
|
|
url="https://github.com/giampaolo/psutil"
|
|
msys2_references=(
|
|
'pypi: psutil'
|
|
"cpe: cpe:2.3:a:psutil_project:psutil"
|
|
)
|
|
license=('spdx:BSD-3-Clause')
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python")
|
|
makedepends=("${MINGW_PACKAGE_PREFIX}-python-build"
|
|
"${MINGW_PACKAGE_PREFIX}-python-installer"
|
|
"${MINGW_PACKAGE_PREFIX}-python-setuptools"
|
|
"${MINGW_PACKAGE_PREFIX}-python-wheel"
|
|
"${MINGW_PACKAGE_PREFIX}-cc")
|
|
checkdepends=("${MINGW_PACKAGE_PREFIX}-python-pytest"
|
|
"${MINGW_PACKAGE_PREFIX}-python-pywin32"
|
|
"${MINGW_PACKAGE_PREFIX}-python-wmi")
|
|
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz"
|
|
"0001-mingw-fixes-without-loadlib.patch"
|
|
"0002-pyparsepid.patch"
|
|
"0003-avoid-duplicate-symbols.patch")
|
|
sha256sums=('6be126e3225486dff286a8fb9a06246a5253f4c7c53b475ea5f5ac934e64194c'
|
|
'df8e02d1970d5f9b7df84ae9ad1ba4f86ae069ffce444ae64801b21f66e37bba'
|
|
'64bd54b3c7cd51d7dd906c8065eee607429e14cfe59d4ddf0720cc8e34918065'
|
|
'd877059c372f9d449dafd9781434d329e28f32fa88d11bd1ec11de30b34a9999')
|
|
|
|
apply_patch_with_msg() {
|
|
for _patch in "$@"
|
|
do
|
|
msg2 "Applying ${_patch}"
|
|
patch -Nbp1 -i "${srcdir}/${_patch}"
|
|
done
|
|
}
|
|
|
|
prepare() {
|
|
cd "${srcdir}"/${_realname}-${pkgver}
|
|
apply_patch_with_msg \
|
|
0001-mingw-fixes-without-loadlib.patch
|
|
|
|
# https://github.com/msys2/MINGW-packages/issues/18460#issuecomment-1717951357
|
|
# CPython defines it as int, so we do as well
|
|
apply_patch_with_msg \
|
|
0002-pyparsepid.patch
|
|
|
|
apply_patch_with_msg \
|
|
0003-avoid-duplicate-symbols.patch
|
|
|
|
cd ${srcdir}
|
|
rm -rf python-build-${MSYSTEM} | true
|
|
cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}"
|
|
}
|
|
|
|
build() {
|
|
cd "${srcdir}/python-build-${MSYSTEM}"
|
|
${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation
|
|
}
|
|
|
|
check() {
|
|
cd "${srcdir}/python-build-${MSYSTEM}"
|
|
_platform=$(python -c "import sysconfig; print(sysconfig.get_platform())")
|
|
_soabi=$(python -c "import sysconfig; print(sysconfig.get_config_var('SOABI'))")
|
|
cd build/lib.${_platform}-${_soabi}
|
|
${MINGW_PREFIX}/bin/python -m pytest || warning "Tests failed"
|
|
}
|
|
|
|
package() {
|
|
cd "${srcdir}/python-build-${MSYSTEM}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=" \
|
|
${MINGW_PREFIX}/bin/python -m installer --prefix=${MINGW_PREFIX} \
|
|
--destdir="${pkgdir}" dist/*.whl
|
|
|
|
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING"
|
|
}
|