bleachbit
bleachbit copied to clipboard
Fix #1084 #1045
@az0 @abitrolly Before starting the PyGtk application I added a check for root with no connection to a display protocol and instead of the error message I show an instruction of how the GUI could be started. This works on my Debian based VMs but I am not sure if the check would be correct under other Linux distributions. Could you take a look at the change and advice? Thanks.
I noticed the build error and will fix it.
It now runs three external process on startup. Is it possible to measure how much time it adds to startup time? I would prefer the check to be on PyGObject level. That would probably need contact with upstream to read the codebase and see if that's possible.
Also, BleachBit can be run without GUI. That still triggers some Gtk functions that don't need the display, and for that I filled the upstream https://gitlab.gnome.org/GNOME/pygobject/-/issues/453 that had been properly responded yet.
Build error because of import
2023-01-07 18:13:05 - WARNING - CodeSign.bat not available for dist\bleachbit_console.exe
2023-01-07 18:13:05 - INFO - Checking bleachbit_console.exe starts
C:\projects\bleachbit\dist\library.zip\win_unicode_console\__init__.py:31: RuntimeWarning: sys.stdin.encoding == 'utf-8', whereas sys.stdout.encoding == 'cp1252', readline hook consumer may assume they are the same
Traceback (most recent call last):
File "bleachbit_console.py", line 28, in <module>
ImportError: No module named 'bleachbit.Unix'
Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "C:\Python34\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\projects\bleachbit\windows\setup_py2exe.py", line 615, in <module>
build()
File "C:\projects\bleachbit\windows\setup_py2exe.py", line 306, in build
assert_execute_console()
File "C:\projects\bleachbit\windows\setup_py2exe.py", line 137, in assert_execute_console
'Success')
File "C:\projects\bleachbit\windows\setup_py2exe.py", line 127, in assert_execute
actual_output = subprocess.check_output(args).decode(setup_encoding)
File "C:\Python34\lib\subprocess.py", line 620, in check_output
raise CalledProcessError(retcode, process.args, output=output)
subprocess.CalledProcessError: Command '['dist\\bleachbit_console.exe', '--gui', '--exit', '--no-uac']' returned non-zero exit status 255
https://ci.appveyor.com/project/az0/bleachbit/builds/45868580#L698
@rados sorry, I had to withdraw from the project, so I won't be able to help with reviewing this. UpWork banned me from the platform, because I can not leave Belarus. I can not earn money and help Andrew with the maintenance. The PR looks like it might make things better, but the real fix of course is to submit a proper patch for GUI detection call to Gtk.
I just did some profiling on my virtual Debian machine. Here the results, several runs around these numbers. Also I did some measurements of the loading time of the app and the results were similar. Host machine is Win 10, CPU Intel(R) Core(TM) i7-4700MQ CPU @ 2.40GHz with a lot of RAM and SSD.
cProfile.run('Unix.is_display_protocol_wayland_and_root_not_allowed()') 1441 function calls in 0.072 seconds
cProfile.run('Unix.is_display_protocol_wayland_and_root_not_allowed()') 1455 function calls in 0.034 seconds
@rados sorry, I had to withdraw from the project, so I won't be able to help with reviewing this. UpWork banned me from the platform, because I can not leave Belarus. I can not earn money and help Andrew with the maintenance. The PR looks like it might make things better, but the real fix of course is to submit a proper patch for GUI detection call to Gtk.
Hey, sorry to hear that. I am in Bulgaria, if I can help somehow, please let me know. Wish you all the best.