96 lines
3.1 KiB
Bash
96 lines
3.1 KiB
Bash
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
|
|
|
_realname=pyserial
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=3.4
|
|
pkgrel=1
|
|
pkgdesc="Multiplatform Serial Port Module for Python (mingw-w64)"
|
|
arch=('any')
|
|
url='https://github.com/pyserial/pyserial/'
|
|
license=('custom:PYTHON')
|
|
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
|
|
"${MINGW_PACKAGE_PREFIX}-python3"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-setuptools"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-setuptools")
|
|
options=('staticlibs' 'strip' '!debug')
|
|
source=("${_realname}-${pkgver}.tar.gz"::"https://github.com/pyserial/pyserial/archive/v${pkgver}.tar.gz")
|
|
sha512sums=('d144897b7b86a6af1f0961fc2b2e71c28419e9afba50245d85c2cb3f1697c2a9d1a4c08576ca8cfb22c5a0adf34e50a62e8c54f903758eece1926d1cb6e83949')
|
|
|
|
prepare() {
|
|
cd "${srcdir}"
|
|
for builddir in python{2,3}-build-${CARCH}; do
|
|
rm -rf ${builddir} | true
|
|
cp -r "${_realname}-${pkgver}" "${builddir}"
|
|
done
|
|
}
|
|
|
|
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() {
|
|
for pver in {2,3}; do
|
|
msg "Python ${pver} test for ${CARCH}"
|
|
cd "${srcdir}/python${pver}-build-${CARCH}"
|
|
${MINGW_PREFIX}/bin/python${pver} setup.py check
|
|
done
|
|
}
|
|
|
|
package_python3-pyserial() {
|
|
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.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE.txt"
|
|
|
|
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
|
|
# fix python command in files
|
|
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
|
|
sed -e "s|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
}
|
|
|
|
package_python2-pyserial() {
|
|
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.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE.txt"
|
|
mv "${pkgdir}"${MINGW_PREFIX}/bin/miniterm.py "${pkgdir}"${MINGW_PREFIX}/bin/miniterm2.py
|
|
|
|
local PREFIX_WIN=$(cygpath -wm ${MINGW_PREFIX})
|
|
# fix python command in files
|
|
for _f in "${pkgdir}${MINGW_PREFIX}"/bin/*.py; do
|
|
sed -e "s|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
}
|
|
|
|
package_mingw-w64-i686-python2-pyserial() {
|
|
package_python2-pyserial
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-pyserial() {
|
|
package_python3-pyserial
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-pyserial() {
|
|
package_python2-pyserial
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-pyserial() {
|
|
package_python3-pyserial
|
|
}
|