diff --git a/beeref/__main__.py b/beeref/__main__.py index 333feac..919683d 100755 --- a/beeref/__main__.py +++ b/beeref/__main__.py @@ -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) diff --git a/beeref/config/settings.py b/beeref/config/settings.py index 9f3cb37..70608cf 100644 --- a/beeref/config/settings.py +++ b/beeref/config/settings.py @@ -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: diff --git a/tools/build_appimage.py b/tools/build_appimage.py index b4ac0f1..04fc765 100755 --- a/tools/build_appimage.py +++ b/tools/build_appimage.py @@ -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/'