Files
MINGW-packages/mingw-w64-python-toml/PKGBUILD

119 lines
3.8 KiB
Bash

# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
_realname=toml
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
pkgver=0.10.0
pkgrel=1
pkgdesc="A Python library for parsing and creating TOML (mingw-w64)"
arch=('any')
url='https://github.com/uiri/toml'
license=('MIT')
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
"${MINGW_PACKAGE_PREFIX}-python3"
"${MINGW_PACKAGE_PREFIX}-python3-setuptools"
"${MINGW_PACKAGE_PREFIX}-python2-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python2-pytest"
"${MINGW_PACKAGE_PREFIX}-python3-pytest")
options=('staticlibs' 'strip' '!debug')
source=("https://files.pythonhosted.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz"
"https://raw.githubusercontent.com/uiri/toml/master/test.toml")
sha512sums=('26f26c38ce9cd48305218c2c34c5a5407b00aefc25a933f044bb7be22c23cfdfa3b8cf2da952d17760c4b9038df62e405fa039cc7b63dd3e94c9c312f04f9182'
'47510e59f9e0bdaaf4052fc5edb570a36b8b173ed7b8e5fac52804f6619f409e545ae3c91f838dbaeefe3c7cfd1a835b699164ac631feaa61de971d2381ac246')
# Helper macros to help make tasks easier #
apply_patch_with_msg() {
for _patch in "$@"
do
msg2 "Applying $_patch"
patch -Nbp1 -i "${srcdir}/$_patch"
done
}
del_file_exists() {
for _fname in "$@"
do
if [ -f $_fname ]; then
rm -rf $_fname
fi
done
}
# =========================================== #
prepare() {
cd "${srcdir}"
# pushd "${_realname}-${pkgver}"
# apply_patch_with_msg 0001-A-really-important-fix.patch \
# 0002-A-less-important-fix.patch
# popd
cp -v test.toml "${_realname}-$pkgver"
for builddir in python{2,3}-build-${CARCH}; do
rm -rf ${builddir} | true
cp -r "${_realname}-${pkgver}" "${builddir}"
done
# Set version for setuptools_scm
export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver
}
# Note that build() is sometimes skipped because it's done in
# the packages setup.py install for simplicity if you can do so.
# but sometimes, you want to do a check before install which would
# also trigger the build.
build() {
for pver in {2,3}; do
msg "Python ${pver} build for ${CARCH}"
cd "${srcdir}/python${pver}-build-${CARCH}"
${MINGW_PREFIX}/bin/python${pver} setup.py build
done
}
check() {
# disable useless tests
msg "Python 2 test for ${CARCH}"
cd "${srcdir}/python2-build-${CARCH}"
${MINGW_PREFIX}/bin/py.test2 tests -k 'not test_invalid_tests and not test_valid_tests'
msg "Python 3 test for ${CARCH}"
cd "${srcdir}/python3-build-${CARCH}"
${MINGW_PREFIX}/bin/py.test tests -k 'not test_invalid_tests and not test_valid_tests'
}
package_python3-toml() {
depends=("${MINGW_PACKAGE_PREFIX}-python3")
cd "${srcdir}/python3-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE"
}
package_python2-toml() {
depends=("${MINGW_PACKAGE_PREFIX}-python2")
cd "${srcdir}/python2-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE"
}
package_mingw-w64-i686-python2-toml() {
package_python2-toml
}
package_mingw-w64-i686-python3-toml() {
package_python3-toml
}
package_mingw-w64-x86_64-python2-toml() {
package_python2-toml
}
package_mingw-w64-x86_64-python3-toml() {
package_python3-toml
}