Merge lp:~jameinel/bzr-explorer/bug396636 into lp:~bzr-explorer-dev/bzr-explorer/trunk.old

Proposed by John A Meinel
Status: Merged
Approved by: Ian Clatworthy
Approved revision: 162
Merged at revision: not available
Proposed branch: lp:~jameinel/bzr-explorer/bug396636
Merge into: lp:~bzr-explorer-dev/bzr-explorer/trunk.old
Diff against target: None lines
To merge this branch: bzr merge lp:~jameinel/bzr-explorer/bug396636
Reviewer Review Type Date Requested Status
Ian Clatworthy Approve
Review via email: mp+8322@code.launchpad.net
To post a comment you must log in.
Revision history for this message
John A Meinel (jameinel) wrote :

This changes the "run_bzr_gui" command to change scripts indicating they should run "bzr foo" into running either:
python path/to/this/bzr foo

or
path/to/this/bzr foo

I've tested that it works correctly when running from source. I haven't tested if it is correct when running from a compiled executable, but I'm pretty sure that I'm using 'sys.frozen' correctly for that case.

I at least looked here:
http://www.velocityreviews.com/forums/showpost.php?p=1767114&postcount=7

Revision history for this message
Ian Clatworthy (ian-clatworthy) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/explorer.py'
2--- lib/explorer.py 2009-07-01 05:36:57 +0000
3+++ lib/explorer.py 2009-07-07 16:43:56 +0000
4@@ -782,6 +782,13 @@
5 # in a dialog if required. Should we use the Qt subprocess stuff here?
6 subprocess.Popen(args)
7
8+ def _get_bzr_executable(self):
9+ if getattr(sys, 'frozen', None) is not None:
10+ # Being run from a compiled executable
11+ return sys.argv[0]
12+ # This should be 'python path/to/bzr'
13+ return [sys.executable, sys.argv[0]]
14+
15 def run_bzr_gui(self, cmd_id, context=None):
16 """Run a bzr GUI application externally.
17
18@@ -790,6 +797,10 @@
19 """
20 args = self.get_command_from_app_suite(cmd_id, context)
21 if args:
22+ if args[0] == 'bzr':
23+ # The config says to run a bzr command, so lets run the one
24+ # that started this process
25+ args[:1] = self._get_bzr_executable()
26 self.run_app(args)
27 else:
28 msg = u"Action not yet supported by current app_suite."

Subscribers

People subscribed via source and target branches