Skip to content

Commit

Permalink
Merge pull request msys2#22921 from podsvirov/python-pypng-new-package
Browse files Browse the repository at this point in the history
[new package] python-pypng 0.20231004.0
  • Loading branch information
podsvirov authored Dec 27, 2024
1 parent 4a34818 commit 6df386d
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions mingw-w64-python-pypng/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Maintainer: Konstantin Podsvirov <[email protected]>

_realname=pypng
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}"
"${MINGW_PACKAGE_PREFIX}-python-${_realname}-docs")
pkgver=0.20231004.0
pkgrel=1
pkgdesc='Pure Python library for PNG image encoding/decoding (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://gitlab.com/drj11/pypng'
license=('spdx:MIT')
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-sphinx")
options=('!strip')
source=("${url}/-/archive/${_realname}-${pkgver}/${_realname}-${_realname}-${pkgver}.tar.gz"
"${url}/-/commit/e5b02fab72436f10b12e04ca6763b42495a586a3.patch")
sha256sums=('e32c8ea6a6801dadede06f9e0e9122b50d93405dd30c1e3c4f9f44bb94090a25'
'b4d8b503cb42680ef9cd7ab7d43c18e5ff5c39b093c0895afb7bae8d3f074026')

prepare() {
cd "${_realname}-${_realname}-${pkgver}"

# In Sphinx doc, Use a configparser
patch -p1 -i "${srcdir}"/e5b02fab72436f10b12e04ca6763b42495a586a3.patch
}

build() {
cp -r "${_realname}-${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"

python -m build --wheel --skip-dependency-check --no-isolation

make -C man html
}

package_python-pypng() {
cd "python-build-${MSYSTEM}"

MSYS2_ARG_CONV_EXCL="--prefix=" \
python -m installer --prefix=${MINGW_PREFIX} \
--destdir="${pkgdir}" dist/*.whl

install -Dm644 LICENCE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}

package_python-pypng-docs() {
pkgdesc+=" (documentation)"
depends=()

mkdir -p "${pkgdir}${MINGW_PREFIX}/share/doc/python-${_realname}"
cp -a "${srcdir}/python-build-${MSYSTEM}/man/_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;

0 comments on commit 6df386d

Please sign in to comment.