Skip to content

Commit

Permalink
use wrappers to ensure the environment is configured
Browse files Browse the repository at this point in the history
before trying to import the gi bindings
  • Loading branch information
totaam committed Mar 9, 2024
1 parent 6b4aac3 commit f6cd59c
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 8 deletions.
6 changes: 4 additions & 2 deletions fs/libexec/xpra/auth_dialog
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@

import sys

from xpra.gtk_common.auth_dialog import main
sys.exit(main())
from xpra.platform import program_context
with program_context("Authentication", "Authentication"):
from xpra.gtk_common.auth_dialog import main
sys.exit(main())
3 changes: 2 additions & 1 deletion packaging/MSWindows/MINGW_BUILD.sh
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ rm -f ./libjasper*
# Python modules:
rm -fr ./lib2to3* ./xdg* ./olefile* ./pygtkcompat* keyring/testing ./jaraco* ./p11-kit* ./lz4
#remove codecs we don't need:
rm -f ./libSvt* ./libx265* ./libjxl* ./libde265* ./libkvazaar*
rm -f ./libde265* ./libkvazaar*
if [ "${DO_FULL}" == "0" ]; then
# kerberos / gss libs:
rm -f ./libshishi* ./libgss*
Expand All @@ -430,6 +430,7 @@ if [ "${DO_FULL}" == "0" ]; then
rm -f ./libmp3* ./libwavpack* ./libmpdec* ./libspeex* ./libFLAC* ./libmpg123* ./libfaad* ./libfaac*
# ffmpeg:
rm -f ./avcodec* ./avformat* ./avutil* ./xvidcore* ./swscale* ./libzvbi* ./libbluray* ./libva*
rm -f ./libSvt* ./libx265* ./libjxl*
# matching gstreamer modules:
pushd ./gstreamer-1.0
rm -f ./libgstflac* ./libgstwavpack* ./libgstspeex* ./libgstwavenc* ./libgstlame* ./libgstmpg123* ./libgstfaac* ./libgstfaad* ./libgstwav*
Expand Down
20 changes: 20 additions & 0 deletions packaging/MSWindows/tools/events_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# This file is part of Xpra.
# Copyright (C) 2024 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys


def main():
# pylint: disable=import-outside-toplevel
from xpra.platform import program_context
with program_context("GTK-Info", "GTK Info"):
from xpra.platform.win32 import gui
return gui.main()


if __name__ == "__main__":
v = main()
sys.exit(v)
20 changes: 20 additions & 0 deletions packaging/MSWindows/tools/gtk_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# This file is part of Xpra.
# Copyright (C) 2024 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys


def main():
# pylint: disable=import-outside-toplevel
from xpra.platform import program_context
with program_context("GTK-Info", "GTK Info"):
from xpra.gtk import info
return info.main()


if __name__ == "__main__":
v = main()
sys.exit(v)
20 changes: 20 additions & 0 deletions packaging/MSWindows/tools/gtk_keyboard_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# This file is part of Xpra.
# Copyright (C) 2024 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys


def main():
# pylint: disable=import-outside-toplevel
from xpra.platform import program_context
with program_context("GTK-Keyboard-Test", "GTK Keyboard Test"):
from xpra.gtk_common import gtk_view_keyboard
return gtk_view_keyboard.main()


if __name__ == "__main__":
v = main()
sys.exit(v)
20 changes: 20 additions & 0 deletions packaging/MSWindows/tools/screenshot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# This file is part of Xpra.
# Copyright (C) 2024 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys


def main(argv=()):
# pylint: disable=import-outside-toplevel
from xpra.platform import program_context
with program_context("Screenshot", "Screenshot"):
from xpra.platform.win32 import gdi_screen_capture
return gdi_screen_capture.main()


if __name__ == "__main__":
v = main()
sys.exit(v)
20 changes: 20 additions & 0 deletions packaging/MSWindows/tools/systemtray_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
# This file is part of Xpra.
# Copyright (C) 2024 Antoine Martin <antoine@xpra.org>
# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
# later version. See the file COPYING for details.

import sys


def main():
# pylint: disable=import-outside-toplevel
from xpra.platform import program_context
with program_context("SystemTray-Test", "SystemTray Test"):
from xpra.client.gtk3.example import tray
return tray.main()


if __name__ == "__main__":
v = main()
sys.exit(v)
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,12 +1606,12 @@ def add_service_exe(script, icon, base_name):
add_gui_exe("fs/bin/xpra_launcher", "xpra.ico", "Xpra-Launcher")
if win32_tools_ENABLED:
add_console_exe("fs/bin/xpra_launcher", "xpra.ico", "Xpra-Launcher-Debug")
add_gui_exe("xpra/gtk_common/gtk_view_keyboard.py", "keyboard.ico", "GTK_Keyboard_Test")
add_gui_exe("packaging/MSWindows/tools/gtk_keyboard_test.py", "keyboard.ico", "GTK_Keyboard_Test")
add_gui_exe("xpra/scripts/bug_report.py", "bugs.ico", "Bug_Report")
if shadow_ENABLED:
add_gui_exe("xpra/platform/win32/scripts/shadow_server.py", "server-notconnected.ico", "Xpra-Shadow")
if win32_tools_ENABLED:
add_gui_exe("xpra/platform/win32/gdi_screen_capture.py", "screenshot.ico", "Screenshot")
add_gui_exe("packaging/MSWindows/tools/screenshot.py", "screenshot.ico", "Screenshot")
if win32_tools_ENABLED and server_ENABLED:
add_gui_exe("fs/libexec/xpra/auth_dialog", "authentication.ico", "Auth_Dialog")
# Console: provide an Xpra_cmd.exe we can run from the cmd.exe shell
Expand All @@ -1632,7 +1632,7 @@ def add_service_exe(script, icon, base_name):
add_console_exe("xpra/scripts/gtk_info.py", "gtk.ico", "GTK_info")
add_console_exe("xpra/gtk_common/keymap.py", "keymap.ico", "Keymap_info")
add_console_exe("xpra/platform/keyboard.py", "keymap.ico", "Keyboard_info")
add_gui_exe("xpra/client/gtk3/example/tray.py", "xpra.ico", "SystemTray_Test")
add_gui_exe("packaging/MSWindows/tools/systemtray_test.py", "xpra.ico", "SystemTray_Test")
add_gui_exe("xpra/client/gtk3/u2f_tool.py", "authentication.ico", "U2F_Tool")
if client_ENABLED or server_ENABLED:
add_console_exe("xpra/platform/win32/scripts/execfile.py", "python.ico", "Python_execfile_cmd")
Expand All @@ -1653,7 +1653,7 @@ def add_service_exe(script, icon, base_name):
add_console_exe("xpra/platform/features.py", "features.ico", "Feature_info")
if client_ENABLED:
add_console_exe("xpra/platform/gui.py", "browse.ico", "NativeGUI_info")
add_console_exe("xpra/platform/win32/gui.py", "loop.ico", "Events_Test")
add_console_exe("packaging/MSWindows/tools/events_test.py", "loop.ico", "Events_Test")
if audio_ENABLED:
add_console_exe("xpra/audio/gstreamer_util.py", "gstreamer.ico", "GStreamer_info")
add_console_exe("xpra/platform/win32/directsound.py", "speaker.ico", "Audio_Devices")
Expand Down
2 changes: 1 addition & 1 deletion xpra/scripts/bug_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ def main(argv=()):
# pylint: disable=import-outside-toplevel
from xpra.platform import program_context
from xpra.platform.gui import init, set_default_icon
from xpra.gtk_common.gtk_util import init_display_source
with program_context("Xpra-Bug-Report", "Xpra Bug Report"):
from xpra.log import enable_color
enable_color()
from xpra.gtk_common.gtk_util import init_display_source
init_display_source()
set_default_icon("bugs.png")
init()
Expand Down

0 comments on commit f6cd59c

Please sign in to comment.