105 lines
3.7 KiB
Bash
105 lines
3.7 KiB
Bash
# Maintainer: Alexey Pavlov <alexpux@gmail.com>
|
|
|
|
_realname=can
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=3.0.0
|
|
pkgrel=1
|
|
pkgdesc="Provides controller area network (CAN) support for Python developers (mingw-w64)"
|
|
arch=('any')
|
|
license=('LGPLv3')
|
|
url="https://python-can.readthedocs.io/en/master/"
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python2-setuptools"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-setuptools")
|
|
checkdepends=("${MINGW_PACKAGE_PREFIX}-python2-mock"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-nose"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pytest"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pytest-timeout"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pytest-cov"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-codecov"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-future"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-six"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-mock"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-nose"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pytest"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pytest-timeout"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pytest-cov"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-codecov"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-future"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-six")
|
|
source=(${_realname}-${pkgver}.tar.gz::https://github.com/hardbyte/python-can/archive/${pkgver}.tar.gz)
|
|
sha256sums=('2e90e630956c30493f150f7489ecf0233cf3df7d3b9c42299d6841ab166d8253')
|
|
|
|
prepare() {
|
|
cd "${srcdir}/python-${_realname}-${pkgver}"
|
|
|
|
cd "${srcdir}"
|
|
for pver in {2,3}; do
|
|
rm -rf python${pver}-build-${CARCH} | true
|
|
cp -r "python-${_realname}-${pkgver}" "python${pver}-build-${CARCH}"
|
|
done
|
|
}
|
|
|
|
build() {
|
|
cd "${srcdir}"
|
|
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
|
|
}
|
|
|
|
package_python3-can() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python3"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-python_ics"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pyserial")
|
|
|
|
cd "${srcdir}/python3-build-${CARCH}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=;--install-purelib=;--install-data=" \
|
|
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
|
|
|
|
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-can() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python2"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-python_ics"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pyserial")
|
|
|
|
cd "${srcdir}/python2-build-${CARCH}"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=;--install-purelib=;--install-data=" \
|
|
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" --optimize=1
|
|
|
|
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
|
|
|
|
for ff in logger player viewer; do
|
|
mv ${pkgdir}${MINGW_PREFIX}/bin/can_${ff}{,2}.py
|
|
done
|
|
}
|
|
|
|
package_mingw-w64-i686-python2-can() {
|
|
package_python2-can
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-can() {
|
|
package_python3-can
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-can() {
|
|
package_python2-can
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-can() {
|
|
package_python3-can
|
|
}
|