# Maintainer: J. Peter Mugaas # _realname=linecache2 pkgbase=mingw-w64-python-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-python2-${_realname}" pkgver=1.0.0 pkgrel=1 pkgdesc="Backports of the linecache module (mingw-w64)" arch=('any') url='https://github.com/testing-cabal/linecache2' license=('PSF') makedepends=("${MINGW_PACKAGE_PREFIX}-python2" "${MINGW_PACKAGE_PREFIX}-python2-pbr" "${MINGW_PACKAGE_PREFIX}-python2-setuptools") options=('staticlibs' 'strip' '!debug') source=("${_realname}-$pkgver.tar.gz"::"https://github.com/testing-cabal/linecache2/archive/$pkgver.tar.gz" fix-syntax-error.patch) sha256sums=('ac729083392b8cc7dd8226bd22fd71d212d15074f098f3b0937bf8b4a774d006' '353030542b2c36c1aa182ae46025d2b099b127a5975b18d90c3a4d409563f5a9') # 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}" # patch from Debian Linux apply_patch_with_msg fix-syntax-error.patch popd rm -rf python2-build-${CARCH} | true cp -r "${_realname}-${pkgver}" "python2-build-${CARCH}" # Set version for setuptools_scm export SETUPTOOLS_SCM_PRETEND_VERSION=$pkgver export PBR_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() { msg "Python 2 build for ${CARCH}" cd "${srcdir}/python2-build-${CARCH}" ${MINGW_PREFIX}/bin/python${pver} setup.py build } check() { msg "Python 2 test for ${CARCH}" cd "${srcdir}/python2-build-${CARCH}" ${MINGW_PREFIX}/bin/python2 -m unittest2 discover } package() { 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 }