Appimage: Add workaround for older Wayland versions (see #102)

This commit is contained in:
Rebecca Breu 2024-04-28 22:20:44 +02:00
parent 6ddccd875d
commit 9356f53b40
3 changed files with 25 additions and 6 deletions

View file

@ -107,7 +107,8 @@ def main():
settings = BeeSettings()
logger.info(f'Using settings: {settings.fileName()}')
logger.info(f'Logging to: {logfile_name()}')
CommandlineArgs(with_check=True) # Force checking
args = CommandlineArgs(with_check=True) # Force checking
assert not args.debug_raise_error, args.debug_raise_error
os.environ["QT_DEBUG_PLUGINS"] = "1"
app = BeeRefApplication(sys.argv)

View file

@ -55,6 +55,10 @@ parser.add_argument(
default=False,
action='store_true',
help='draw item\'s transform handle areas for debugging')
parser.add_argument(
'--debug-raise-error',
default='',
help='immediately exit with given error message')
class CommandlineArgs:

View file

@ -137,7 +137,7 @@ ld_paths = ['${APPDIR}' + p for p in paths] + ['${LD_LIBRARY_PATH}']
ld_paths = ':'.join(ld_paths)
logger.debug(f'LD_LIBRARY_PATH: {ld_paths}')
content = """#! /bin/bash
content = ["""#! /bin/bash
# If running from an extracted image, then export ARGV0 and APPDIR
if [ -z "${APPIMAGE}" ]; then
@ -154,12 +154,26 @@ export APPIMAGE_COMMAND=$(command -v -- "$ARGV0")
# Export SSL certificate
export SSL_CERT_FILE="${APPDIR}/opt/_internal/certs.pem"
"""
content += f'export LD_LIBRARY_PATH="{ld_paths}"\n'
content += f'"$APPDIR/opt/python{PYVER}/bin/python{PYVER}" -I -m beeref "$@"\n'
"""]
runbee = f'"$APPDIR/opt/python{PYVER}/bin/python{PYVER}" -I -m beeref "$@"'
logfile = '/tmp/BeeRefAppimageLog.txt'
content.extend([
f'export LD_LIBRARY_PATH="{ld_paths}"',
f'{runbee} 2> >(tee {logfile} >&2)',
'if [ $? -ne 0 ]; then',
# Workaround for:
# https://bugreports.qt.io/browse/QTBUG-114635
# See also https://github.com/rbreu/beeref/issues/102
f' if grep -q wl_proxy_marshal_flags {logfile}; then',
' echo "Wayland version error; trying again without Wayland"',
f' QT_QPA_PLATFORM=xcb {runbee}',
'fi; fi;'])
with open('squashfs-root/AppRun', 'w') as f:
f.write(content)
f.write('\n'.join(content))
os.chmod('squashfs-root/AppRun', 0o755)
url = ('https://github.com/AppImage/AppImageKit/releases/download/'