115 lines
4.2 KiB
Bash
115 lines
4.2 KiB
Bash
_pyname=rst2pdf
|
|
_realname=rst2pdf
|
|
pkgbase=mingw-w64-python-${_realname}
|
|
pkgname=("${MINGW_PACKAGE_PREFIX}-python2-${_realname}" "${MINGW_PACKAGE_PREFIX}-python3-${_realname}")
|
|
pkgver=0.93
|
|
pkgrel=4
|
|
pkgdesc="Create PDFs from simple text markup, no LaTeX required (mingw-w64)"
|
|
arch=('any')
|
|
url='https://github.com/ralsina/rst2pdf'
|
|
license=('MIT')
|
|
makedepends=("${MINGW_PACKAGE_PREFIX}-python2"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-docutils"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pdfrw"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pygments"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-reportlab>=2.4"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-setuptools"
|
|
"${MINGW_PACKAGE_PREFIX}-python3"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-docutils"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pdfrw"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pygments"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-reportlab>=2.4"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-setuptools")
|
|
options=('staticlibs' 'strip' '!debug')
|
|
source=(${_realname}-${pkgver}.tar.gz::"https://github.com/${_realname}/${_realname}/archive/${pkgver}.tar.gz")
|
|
sha256sums=('37e99ea103790321b29b6f6b0192821ba9c2990a6aec57295585ca6919932a97')
|
|
|
|
prepare() {
|
|
for builddir in python{2,3}-build; do
|
|
rm -rf $builddir | true
|
|
cp -r "${_pyname}-${pkgver}" "${builddir}"
|
|
done
|
|
}
|
|
|
|
check() {
|
|
for pver in {2,3}; do
|
|
msg "Python ${pver} test for ${CARCH}"
|
|
cd "${srcdir}/python${pver}-build"
|
|
${MINGW_PREFIX}/bin/python${pver} setup.py check
|
|
done
|
|
${MINGW_PREFIX}/bin/2to3 -w "${srcdir}/python3-build"
|
|
}
|
|
|
|
package_python3-rst2pdf() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python3"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-docutils"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pdfrw"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-pygments"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-reportlab>=2.4"
|
|
"${MINGW_PACKAGE_PREFIX}-python3-setuptools")
|
|
# just in case some package wants to use the rst2pdf executable.
|
|
provides=("${MINGW_PACKAGE_PREFIX}-rst2pdf")
|
|
|
|
local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX})
|
|
|
|
cd "${srcdir}/python3-build"
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
|
|
--root="${pkgdir}" --optimize=1
|
|
|
|
install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE.txt"
|
|
|
|
# fix python command in files
|
|
cd "${pkgdir}${MINGW_PREFIX}/bin"
|
|
sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i rst2pdf-script.py
|
|
}
|
|
|
|
package_python2-rst2pdf() {
|
|
depends=("${MINGW_PACKAGE_PREFIX}-python2"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-docutils"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pdfrw"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-pygments"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-reportlab>=2.4"
|
|
"${MINGW_PACKAGE_PREFIX}-python2-setuptools")
|
|
# just in case some package wants to use the rst2pdf executable
|
|
provides=("${MINGW_PACKAGE_PREFIX}-rst2pdf")
|
|
|
|
local _mingw_prefix=$(cygpath -am ${MINGW_PREFIX})
|
|
|
|
cd "${srcdir}/python2-build"
|
|
|
|
MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
|
|
${MINGW_PREFIX}/bin/python2 setup.py install --prefix=${MINGW_PREFIX} \
|
|
--root="${pkgdir}" --optimize=1
|
|
install -Dm644 LICENSE.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE.txt"
|
|
|
|
# fix python command in files
|
|
cd "${pkgdir}${MINGW_PREFIX}/bin"
|
|
sed -e "s|${_mingw_prefix}/bin/|/usr/bin/env |g" -i rst2pdf-script.py
|
|
|
|
for f in rst2pdf; do
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe
|
|
if [ -f "${pkgdir}${MINGW_PREFIX}"/bin/${f}.exe.manifest ]; then
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}.exe.manifest
|
|
sed -e "s|${f}|${f}2|g" -i "${pkgdir}${MINGW_PREFIX}"/bin/${f}2.exe.manifest
|
|
fi
|
|
mv "${pkgdir}${MINGW_PREFIX}"/bin/${f}{,2}-script.py
|
|
done
|
|
}
|
|
|
|
package_mingw-w64-i686-python2-rst2pdf() {
|
|
package_python2-rst2pdf
|
|
}
|
|
|
|
package_mingw-w64-i686-python3-rst2pdf() {
|
|
package_python3-rst2pdf
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python2-rst2pdf() {
|
|
package_python2-rst2pdf
|
|
}
|
|
|
|
package_mingw-w64-x86_64-python3-rst2pdf() {
|
|
package_python3-rst2pdf
|
|
}
|