summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Sturmlechner <asturm@gentoo.org>2020-08-06 23:39:59 +0200
committerAndreas Sturmlechner <asturm@gentoo.org>2020-09-27 19:34:35 +0200
commit5b335dc89970d19a8539a7d5eaa5dcdc1a51b7cb (patch)
treea4c281d9cc6e46696d8437a9f9e8b0684a98c7cd /app-office
parentsys-fs/bindfs: 1.14.8 (diff)
downloadgentoo-5b335dc89970d19a8539a7d5eaa5dcdc1a51b7cb.tar.gz
gentoo-5b335dc89970d19a8539a7d5eaa5dcdc1a51b7cb.tar.bz2
gentoo-5b335dc89970d19a8539a7d5eaa5dcdc1a51b7cb.zip
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@gmail.com> Closes: https://bugs.gentoo.org/667802 Package-Manager: Portage-3.0.1, Repoman-2.3.23 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
Diffstat (limited to 'app-office')
-rw-r--r--app-office/libreoffice/libreoffice-6.4.9999.ebuild34
-rw-r--r--app-office/libreoffice/libreoffice-9999.ebuild34
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 6f4a72b4e475..52876b5d2f11 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 3cd82d82602e..a4e55bc75952 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() {