Files
MINGW-packages/mingw-w64-python-pycodestyle/PKGBUILD
2021-01-06 23:38:34 +05:30

79 lines
2.4 KiB
Bash

# Maintainer: J. Peter Mugaas <jpmugaas@suddenlink.net>
#This value is here because some python package names have capital letters
#while there is a strong preference for lowercase letters in ArchLinux and
#MSYS packages.
_realname=pycodestyle
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}"
"${MINGW_PACKAGE_PREFIX}-pep8-python3"
"${MINGW_PACKAGE_PREFIX}-python3-pep8")
pkgver=2.6.0
pkgrel=1
pkgdesc="Python style guide checker (mingw-w64)"
arch=('any')
url='https://github.com/PyCQA/pycodestyle'
license=('custom:Expat')
depends=("${MINGW_PACKAGE_PREFIX}-python")
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools")
install=${_realname}3-${CARCH}.install
options=('staticlibs' 'strip' '!debug')
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/PyCQA/pycodestyle/archive/${pkgver}.tar.gz")
sha256sums=('08347fbc48cc92afd33117c1e8af9b99b292a4e5889f6b776f402e062fc39c97')
# 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}"
rm -rf python-build-${CARCH} | true
cp -r "${_realname}-${pkgver}" "python-build-${CARCH}"
}
build() {
msg "Python build for ${CARCH}"
cd "${srcdir}/python-build-${CARCH}"
${MINGW_PREFIX}/bin/python setup.py build
}
check() {
msg "Python test for ${CARCH}"
cd "${srcdir}/python-build-${CARCH}"
# two of these tests are known to fail in Windows
${MINGW_PREFIX}/bin/python -m unittest discover testsuite || true
}
package() {
cd "${srcdir}/python-build-${CARCH}"
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} \
--root="${pkgdir}" --optimize=1 --skip-build
install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/COPYING"
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
# fix python command in files
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
sed -e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
done
}