Rev 162: Fix bug #396636 by using sys.argv[0] as necessary. in http://bzr.arbash-meinel.com/plugins/explorer

John Arbash Meinel john at arbash-meinel.com
Tue Jul 7 17:44:00 BST 2009


At http://bzr.arbash-meinel.com/plugins/explorer

------------------------------------------------------------
revno: 162
revision-id: john at arbash-meinel.com-20090707164356-7b3mwv1zyhrnldb6
parent: ian.clatworthy at canonical.com-20090702104137-jseoixkwi90eg6sb
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: explorer
timestamp: Tue 2009-07-07 11:43:56 -0500
message:
  Fix bug #396636 by using sys.argv[0] as necessary.
-------------- next part --------------
=== modified file 'lib/explorer.py'
--- a/lib/explorer.py	2009-07-01 05:36:57 +0000
+++ b/lib/explorer.py	2009-07-07 16:43:56 +0000
@@ -782,6 +782,13 @@
         # in a dialog if required. Should we use the Qt subprocess stuff here?
         subprocess.Popen(args)
 
+    def _get_bzr_executable(self):
+        if getattr(sys, 'frozen', None) is not None:
+            # Being run from a compiled executable
+            return sys.argv[0]
+        # This should be 'python path/to/bzr'
+        return [sys.executable, sys.argv[0]]
+
     def run_bzr_gui(self, cmd_id, context=None):
         """Run a bzr GUI application externally.
 
@@ -790,6 +797,10 @@
         """
         args = self.get_command_from_app_suite(cmd_id, context)
         if args:
+            if args[0] == 'bzr':
+                # The config says to run a bzr command, so lets run the one
+                # that started this process
+                args[:1] = self._get_bzr_executable()
             self.run_app(args)
         else:
             msg = u"Action not yet supported by current app_suite."



More information about the bazaar-commits mailing list