From 2b074ee67bc13f55e8a6d75427baaaa423317b44 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Sun, 3 Mar 2024 00:35:45 +0300 Subject: [PATCH] python-wtforms: new package --- mingw-w64-python-wtforms/PKGBUILD | 84 +++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 mingw-w64-python-wtforms/PKGBUILD diff --git a/mingw-w64-python-wtforms/PKGBUILD b/mingw-w64-python-wtforms/PKGBUILD new file mode 100644 index 0000000000..b5de1ce8c7 --- /dev/null +++ b/mingw-w64-python-wtforms/PKGBUILD @@ -0,0 +1,84 @@ +# Maintainer: Konstantin Podsvirov + +_realname=wtforms +pkgbase=mingw-w64-python-${_realname} +pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}" + "${MINGW_PACKAGE_PREFIX}-python-${_realname}-docs") +pkgver=3.1.2 +pkgrel=1 +pkgdesc='A flexible forms validation and rendering library for Python (mingw-w64)' +arch=('any') +mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64') +url='https://wtforms.readthedocs.io/' +msys2_repository_url='https://github.com/wtforms/wtforms' +license=('spdx:BSD-3-Clause') +depends=("${MINGW_PACKAGE_PREFIX}-python" + "${MINGW_PACKAGE_PREFIX}-python-markupsafe") +optdepends=("${MINGW_PACKAGE_PREFIX}-python-email-validator: Email validation") +makedepends=("${MINGW_PACKAGE_PREFIX}-python-babel" + "${MINGW_PACKAGE_PREFIX}-python-build" + "${MINGW_PACKAGE_PREFIX}-python-installer" + "${MINGW_PACKAGE_PREFIX}-python-hatchling" + "${MINGW_PACKAGE_PREFIX}-python-sphinx" + "${MINGW_PACKAGE_PREFIX}-python-sphinx-issues" + "${MINGW_PACKAGE_PREFIX}-python-sphinxcontrib-log-cabinet" + "${MINGW_PACKAGE_PREFIX}-python-pallets-sphinx-themes") +# We do not use the pypi tarball, as there is no docs directory in it +#source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz") +source=("${msys2_repository_url}/archive/${pkgver}/${_realname}-${pkgver}.tar.gz") +sha256sums=('4f2e5cb7dd1fe24d533e6f30eb0d677be39605f049d3b117724207efe4417840') + +prepare() { + rm -rf python-build-${MSYSTEM} | true + cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" + + rm -rf python-install-${MSYSTEM} | true +} + +build() { + cd "${srcdir}/python-build-${MSYSTEM}" + + ${MINGW_PREFIX}/bin/python -m build --wheel --skip-dependency-check --no-isolation + + # Forward installation for building documentation + _pkgdir="${srcdir}/python-install-${MSYSTEM}" + MSYS2_ARG_CONV_EXCL="--prefix=" \ + "${MINGW_PREFIX}"/bin/python -m installer --prefix=${MINGW_PREFIX} \ + --destdir="${_pkgdir}" dist/*.whl + + msg "Build documentation" + cd "${srcdir}/python-build-${MSYSTEM}/docs" + _pyver=$("${MINGW_PREFIX}"/bin/python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") + PYTHONPATH="${_pkgdir}${MINGW_PREFIX}/lib/python${_pyver}/site-packages" \ + "${MINGW_PREFIX}"/bin/sphinx-build -M html . _build +} + +package_python-wtforms() { + msg "Python install for ${MSYSTEM}" + 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.rst "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE.rst" +} + +package_python-wtforms-docs() { + pkgdesc+=" (documentation)" + depends=() + + mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}" + cp -a "${srcdir}/python-build-${MSYSTEM}/docs/_build/html" "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}/html" +} + +# template start; name=mingw-w64-splitpkg-wrappers; version=1.0; +# vim: set ft=bash : + +# generate wrappers +for _name in "${pkgname[@]}"; do + _short="package_${_name#${MINGW_PACKAGE_PREFIX}-}" + _func="$(declare -f "${_short}")" + eval "${_func/#${_short}/package_${_name}}" +done +# template end;