niess / python-appimage

AppImage distributions of Python
https://python-appimage.readthedocs.io/en/latest/
GNU General Public License v3.0
170 stars 24 forks source link

`system()` method from `system.py` propogates runtime warnings as RuntimeErrors #47

Closed Ryex closed 2 years ago

Ryex commented 2 years ago

While working on getting together an Appimage for one of my favorite programs I encountered a build failure because warnings were propagated as errors. this system call method should be edited to ignore such warnings

$ python-appimage build app -p 3.11 novelwriter                                                   
[2022-07-07 18:54:41,192] EXTRACT  python3.11.0-cp311-cp311-manylinux2010_x86_64.AppImage
Traceback (most recent call last):
  File "/home/ryex/.local/bin/python-appimage", line 8, in <module>
    sys.exit(main())
  File "/home/ryex/.local/lib/python3.10/site-packages/python_appimage/__main__.py", line 109, in main
    command.execute(*command._unpack_args(args))
  File "/home/ryex/.local/lib/python3.10/site-packages/python_appimage/commands/build/app.py", line 162, in execute
    system((base_image, '--appimage-extract'))
  File "/home/ryex/.local/lib/python3.10/site-packages/python_appimage/utils/system.py", line 42, in system
    raise RuntimeError(err)
RuntimeError: Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.

this is already done with exclude.append('fuse: warning:') but a more generic check for warnings should be used

these warnings may need to be propagated out to stderr but they should not halt.

niess commented 2 years ago

Hello @Ryex,

thank you for pointing this out. The problem is that it is not always straightforward to tell where a warning ends, and where an error starts. Therefore, I opted for a strict policy where only "known" warnings were accepted. However, I agree that this can be annoying in some unexpected/new cases. Thus, I changed the system method. Now, it accepts single-line warnings starting with warning: (case insensitive). Those do not trigger any system error anymore, but they are forwarded to the logger. This should cover a large range of "warning" cases.