From 824d504a65cffcd753b9dcfb6a4aad15ef6a03a8 Mon Sep 17 00:00:00 2001 From: Thomas Leonard Date: Sun, 20 Mar 2011 16:18:37 +0000 Subject: [PATCH] Run the GUI using sys.executable Avoids having to change the #! line depending on how Python is named. --- tests/basetest.py | 2 +- zeroinstall/helpers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/basetest.py b/tests/basetest.py index e459409..250a686 100755 --- a/tests/basetest.py +++ b/tests/basetest.py @@ -37,7 +37,7 @@ mydir = os.path.dirname(__file__) # Catch us trying to run the GUI and return a dummy string instead old_execvp = os.execvp def test_execvp(prog, args): - if prog.endswith('/0launch-gui'): + if prog == sys.executable and args[1].endswith('/0launch-gui'): prog = os.path.join(mydir, 'test-gui') return old_execvp(prog, args) diff --git a/zeroinstall/helpers.py b/zeroinstall/helpers.py index 10c3bd0..81ef23d 100644 --- a/zeroinstall/helpers.py +++ b/zeroinstall/helpers.py @@ -46,7 +46,7 @@ def get_selections_gui(iface_uri, gui_args, test_callback = None): os.dup2(gui.fileno(), 0) if iface_uri is not None: gui_args = gui_args + ['--', iface_uri] - os.execvp(gui_exe, [gui_exe] + gui_args) + os.execvp(sys.executable, [sys.executable, gui_exe] + gui_args) except: import traceback traceback.print_exc(file = sys.stderr) -- 2.11.4.GIT