Merge lp:~garyvdm/tortoisebzr/bug641557-b into lp:~tortoisebzr-developers/tortoisebzr/trunk-2a

Proposed by Gary van der Merwe
Status: Merged
Merged at revision: 353
Proposed branch: lp:~garyvdm/tortoisebzr/bug641557-b
Merge into: lp:~tortoisebzr-developers/tortoisebzr/trunk-2a
Diff against target: 43 lines (+1/-28)
1 file modified
scripts/tbzrcommand.py (+1/-28)
To merge this branch: bzr merge lp:~garyvdm/tortoisebzr/bug641557-b
Reviewer Review Type Date Requested Status
methane Approve
Review via email: mp+36106@code.launchpad.net

Description of the change

This removes the code to adjust the sys.executable/sys.argv[0]. This should rather be handled by qbzr subprocess launching.
This merge goes together with lp:~garyvdm/qbzr/bug641557-b , which adds code to handle running from tbzrcommand, and other scripts.

A test installer build with both these branches is available here:
 http://dl.dropbox.com/u/4494367/bzr-2.2.1%7Ec-setup.exe

To post a comment you must log in.
Revision history for this message
methane (songofacandy) wrote :

I'm happy to remove this code.
BTW, qbzr works well without this fix?
Should I make new release today for bzr-2.2.1?

review: Approve
Revision history for this message
Gary van der Merwe (garyvdm) wrote :

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 21/09/2010 10:08, INADA Naoki wrote:
> Should I make new release today for bzr-2.2.1?

Yes please.

I'll also release qbzr 0.19.2

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyYaIMACgkQd/3EdwGKOh3wFACaAidempECoVMQdKDZmwnMRBmy
2x8AoMUfkpq5qMiHUaD42IndOyaekL5O
=naK/
-----END PGP SIGNATURE-----

Revision history for this message
methane (songofacandy) wrote :

I've merged this and find Bazaar Explorer doesn't works when it is launchded from TortoiseBZR.
I want to replace sys.executable and sys.argv[0] to bzr.exe when frozen or python.exe/bzr when not frozen.
Is it OK?

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/tbzrcommand.py'
2--- scripts/tbzrcommand.py 2010-09-20 06:23:49 +0000
3+++ scripts/tbzrcommand.py 2010-09-21 07:21:04 +0000
4@@ -294,39 +294,12 @@
5 if getattr(opt, 'name', None) == 'ui-mode':
6 kw['ui_mode'] = True
7 break
8- # We need to hack up sys.argv for qbzr, so when it spawns a
9- # sub-process it does the right-thing.
10- old_argv = sys.argv[:]
11- old_exe = sys.executable
12+
13 try:
14- # If we are frozen, qbzr assumes sys.argv[0] is bzr.exe
15- if getattr(sys, "frozen", None) is not None:
16- basedir = os.path.abspath(os.path.dirname(sys.argv[0]))
17- bzr_exe = os.path.join(basedir, "bzrw.exe")
18- if not os.path.isfile(bzr_exe):
19- bzr_exe = os.path.join(basedir, "bzr.exe")
20- if not os.path.isfile(bzr_exe):
21- raise RuntimeError("Where is bzr.exe?")
22- argv0 = exe = bzr_exe
23- else:
24- # otherwise it is 'bzr' itself.
25- import bzrlib
26- # are we running directly from a bzr directory?
27- argv0 = os.path.join(bzrlib.__path__[0], "..", "bzr")
28- if not os.path.isfile(argv0):
29- # maybe from an installed bzr?
30- argv0 = os.path.join(sys.prefix, "scripts", "bzr")
31- if not os.path.isfile(argv0):
32- raise RuntimeError("Can't find a bzr to execute.")
33- exe = old_exe
34- sys.argv[0] = argv0
35- sys.executable = exe
36 # finally get down to business...
37 instance = klass()
38 invoker(instance, arg_name, filenames, directory, kw)
39 finally:
40- sys.argv = old_argv
41- sys.executable = old_exe
42 if need_refresh:
43 refresh_cache(filenames, directory)
44

Subscribers

People subscribed via source and target branches