commit: 5b335dc89970d19a8539a7d5eaa5dcdc1a51b7cb Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> AuthorDate: Thu Aug 6 21:39:59 2020 +0000 Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> CommitDate: Sun Sep 27 17:34:35 2020 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5b335dc8
app-office/libreoffice: Link python bridge in site-packages, drop patch Essentially syncing with openSUSE changes. - Obsolete patching of officehelper.py, uno.py not to break tests, use heredoc - Obsolete patching of soffice.sh by symlinking py files to site-packages - Fix finding pyuno by reshuffling imports - Fix URE_BOOTSTRAP path (bug in v1 of this patch), thanks to dilfridge Reported-by: Jan Psota <jasiupsota <AT> gmail.com> Closes: https://bugs.gentoo.org/667802 Package-Manager: Portage-3.0.1, Repoman-2.3.23 Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org> app-office/libreoffice/libreoffice-6.4.9999.ebuild | 34 +++++++++++++++++----- app-office/libreoffice/libreoffice-9999.ebuild | 34 +++++++++++++++++----- 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/app-office/libreoffice/libreoffice-6.4.9999.ebuild b/app-office/libreoffice/libreoffice-6.4.9999.ebuild index 6f4a72b4e47..52876b5d2f1 100644 --- a/app-office/libreoffice/libreoffice-6.4.9999.ebuild +++ b/app-office/libreoffice/libreoffice-6.4.9999.ebuild @@ -265,7 +265,6 @@ PATCHES=( # "${WORKDIR}"/${PATCHSET/.tar.xz/} # not upstreamable stuff - "${FILESDIR}/${PN}-5.4-system-pyuno.patch" "${FILESDIR}/${PN}-5.3.4.2-kioclient5.patch" "${FILESDIR}/${PN}-6.1-nomancompress.patch" @@ -333,12 +332,6 @@ src_prepare() { # hack in the autogen.sh touch autogen.lastrun - # system pyuno mess - sed -i \ - -e "s:%eprefix%:${EPREFIX}:g" \ - -e "s:%libdir%:$(get_libdir):g" \ - pyuno/source/module/uno.py \ - pyuno/source/officehelper.py || die # sed in the tests sed -i \ -e "s#all : build unitcheck#all : build#g" \ @@ -555,6 +548,33 @@ src_install() { # bug 703474 insinto /usr/include doins -r include/LibreOfficeKit + + local lodir=/usr/$(get_libdir)/libreoffice + # patching this would break tests + cat <<-EOF > "${T}"/uno.py +import sys, os +sys.path.append('${EPREFIX}${lodir}/program') +os.putenv('URE_BOOTSTRAP', 'vnd.sun.star.pathname:${EPREFIX}${lodir}/program/fundamentalrc') +EOF + sed -e "/^import sys/d" -e "/^import os/d" \ + -i "${D}"${lodir}/program/uno.py || die "cleanup dupl imports failed" + cat "${D}"${lodir}/program/uno.py >> "${T}"/uno.py || die + cp "${T}"/uno.py "${D}"${lodir}/program/uno.py || die + + # more system pyuno mess + sed -e "/sOffice = \"\" # lets hope for the best/s:\"\":\"${EPREFIX}${lodir}/program\":" \ + -i "${D}"${lodir}/program/officehelper.py || die + + python_optimize "${D}"${lodir}/program + # link python bridge in site-packages, bug 667802 + local py pyc loprogdir=$(get_libdir)/libreoffice/program + for py in uno.py unohelper.py officehelper.py; do + dosym ../../../${loprogdir}/${py} $(python_get_sitedir)/${py} + while IFS="" read -d $'\0' -r pyc; do + pyc=${pyc//*\/} + dosym ../../../../${loprogdir}/__pycache__/${pyc} $(python_get_sitedir)/__pycache__/${pyc} + done < <(find "${D}"${lodir}/program -type f -name ${py/.py/*.pyc} -print0) + done } pkg_postinst() { diff --git a/app-office/libreoffice/libreoffice-9999.ebuild b/app-office/libreoffice/libreoffice-9999.ebuild index 3cd82d82602..a4e55bc7595 100644 --- a/app-office/libreoffice/libreoffice-9999.ebuild +++ b/app-office/libreoffice/libreoffice-9999.ebuild @@ -269,7 +269,6 @@ PATCHES=( # "${WORKDIR}"/${PATCHSET/.tar.xz/} # not upstreamable stuff - "${FILESDIR}/${PN}-5.4-system-pyuno.patch" "${FILESDIR}/${PN}-5.3.4.2-kioclient5.patch" "${FILESDIR}/${PN}-6.1-nomancompress.patch" ) @@ -333,12 +332,6 @@ src_prepare() { # hack in the autogen.sh touch autogen.lastrun - # system pyuno mess - sed -i \ - -e "s:%eprefix%:${EPREFIX}:g" \ - -e "s:%libdir%:$(get_libdir):g" \ - pyuno/source/module/uno.py \ - pyuno/source/officehelper.py || die # sed in the tests sed -i \ -e "s#all : build unitcheck#all : build#g" \ @@ -555,6 +548,33 @@ src_install() { # bug 703474 insinto /usr/include doins -r include/LibreOfficeKit + + local lodir=/usr/$(get_libdir)/libreoffice + # patching this would break tests + cat <<-EOF > "${T}"/uno.py +import sys, os +sys.path.append('${EPREFIX}${lodir}/program') +os.putenv('URE_BOOTSTRAP', 'vnd.sun.star.pathname:${EPREFIX}${lodir}/program/fundamentalrc') +EOF + sed -e "/^import sys/d" -e "/^import os/d" \ + -i "${D}"${lodir}/program/uno.py || die "cleanup dupl imports failed" + cat "${D}"${lodir}/program/uno.py >> "${T}"/uno.py || die + cp "${T}"/uno.py "${D}"${lodir}/program/uno.py || die + + # more system pyuno mess + sed -e "/sOffice = \"\" # lets hope for the best/s:\"\":\"${EPREFIX}${lodir}/program\":" \ + -i "${D}"${lodir}/program/officehelper.py || die + + python_optimize "${D}"${lodir}/program + # link python bridge in site-packages, bug 667802 + local py pyc loprogdir=$(get_libdir)/libreoffice/program + for py in uno.py unohelper.py officehelper.py; do + dosym ../../../${loprogdir}/${py} $(python_get_sitedir)/${py} + while IFS="" read -d $'\0' -r pyc; do + pyc=${pyc//*\/} + dosym ../../../../${loprogdir}/__pycache__/${pyc} $(python_get_sitedir)/__pycache__/${pyc} + done < <(find "${D}"${lodir}/program -type f -name ${py/.py/*.pyc} -print0) + done } pkg_postinst() {
