pyuno: fix macOS test failures by routing officehelper to App Bundle
During local LODE builds on macOS, the test framework sets UNO_PATH to `instdir/program`. While this works for Linux and Windows, macOS builds generate a native application bundle, placing the executable at `instdir/LibreOfficeDev.app/Contents/MacOS/soffice`. This caused `subprocess.Popen` to throw a `FileNotFoundError` during execution of targets like `PythonTest_pyuno_pytests_testofficehelper`. This patch intercepts the macOS path in `bootstrap()` and dynamically routes it to the correct LibreOfficeDev App Bundle location if the default Linux-style path does not exist. Additionally, this adds a standard Python 3 shebang to the file and fixes a missing newline at EOF. Change-Id: Ie92415941c24e0777087d51a999dcbeae6c06223 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/208052 Reviewed-by: Dan Williams <dcbw@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
committed by
Dan Williams
parent
8976d67f50
commit
3f65cecc11
@@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
|
||||
#
|
||||
# This file is part of the LibreOffice project.
|
||||
@@ -160,8 +161,18 @@ def bootstrap(soffice=None, delays=(1, 3, 5, 7), report=lambda *args: None):
|
||||
sOffice = os.path.join(os.environ["UNO_PATH"], sOffice)
|
||||
elif platform == "darwin": # any other un-hardcoded suggestion?
|
||||
sOffice = "/Applications/LibreOffice.App/Contents/MacOS/soffice"
|
||||
if platform.startswith("win"):
|
||||
sOffice += ".exe"
|
||||
|
||||
# Intercept and correct the path for LODE macOS build environments
|
||||
if platform == "darwin":
|
||||
if "instdir/program/soffice" in sOffice and not os.path.exists(sOffice):
|
||||
sOffice = sOffice.replace(
|
||||
"instdir/program/soffice",
|
||||
"instdir/LibreOfficeDev.app/Contents/MacOS/soffice"
|
||||
)
|
||||
|
||||
if platform.startswith("win"):
|
||||
sOffice += ".exe"
|
||||
|
||||
# Generate a random pipe name.
|
||||
random.seed()
|
||||
sPipeName = "uno" + str(random.random())[2:]
|
||||
@@ -195,4 +206,4 @@ def bootstrap(soffice=None, delays=(1, 3, 5, 7), report=lambda *args: None):
|
||||
os.killpg(os.getpgid(process.pid), signal.SIGTERM) # Send termination signal to process group
|
||||
raise BootstrapException
|
||||
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab
|
||||
# vim: set shiftwidth=4 softtabstop=4 expandtab
|
||||
|
||||
Reference in New Issue
Block a user