101 lines
3.2 KiB
Bash
101 lines
3.2 KiB
Bash
# Maintainer: Smo <smo@xpra.org>
|
|
|
|
_realname=comtypes
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=1.1.7
|
|
pkgrel=2
|
|
pkgdesc="A pure Python, lightweight COM client and server framework, based on the ctypes Python FFI package. (mingw-w64)"
|
|
arch=('any')
|
|
url='https://github.com/enthought/comtypes'
|
|
license=('OSI')
|
|
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/enthought/comtypes/archive/${pkgver}.tar.gz")
|
|
sha512sums=('be83ff1c38306c6ef7994be3fc21f3b533e3d1d26184cf536a38c15cb6435b38ec803d3e3ab08e994444030c022aeab65ec918cc91a2d24c9b25069c0384c0ae')
|
|
|
|
prepare() {
|
|
cd "${srcdir}"
|
|
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
|
|
}
|
|
|
|
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-comtypes() {
|
|
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}/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|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
}
|
|
|
|
package_python2-comtypes() {
|
|
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}/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|/usr/bin/env |${MINGW_PREFIX}|g" \
|
|
-e "s|${PREFIX_WIN}|${MINGW_PREFIX}|g" -i ${_f}
|
|
done
|
|
|
|
for f in clear_comtypes_cache; do
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.py
|
|
done
|
|
}
|
|
|
|
package_mingw-w64-i686-python2-comtypes() {
|
|
package_python2-comtypes
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-comtypes() {
|
|
package_python3-comtypes
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-comtypes() {
|
|
package_python2-comtypes
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-comtypes() {
|
|
package_python3-comtypes
|
|
}
|