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
=== modified file 'scripts/tbzrcommand.py'
--- scripts/tbzrcommand.py 2010-09-20 06:23:49 +0000
+++ scripts/tbzrcommand.py 2010-09-21 07:21:04 +0000
@@ -294,39 +294,12 @@
294 if getattr(opt, 'name', None) == 'ui-mode':294 if getattr(opt, 'name', None) == 'ui-mode':
295 kw['ui_mode'] = True295 kw['ui_mode'] = True
296 break296 break
297 # We need to hack up sys.argv for qbzr, so when it spawns a297
298 # sub-process it does the right-thing.
299 old_argv = sys.argv[:]
300 old_exe = sys.executable
301 try:298 try:
302 # If we are frozen, qbzr assumes sys.argv[0] is bzr.exe
303 if getattr(sys, "frozen", None) is not None:
304 basedir = os.path.abspath(os.path.dirname(sys.argv[0]))
305 bzr_exe = os.path.join(basedir, "bzrw.exe")
306 if not os.path.isfile(bzr_exe):
307 bzr_exe = os.path.join(basedir, "bzr.exe")
308 if not os.path.isfile(bzr_exe):
309 raise RuntimeError("Where is bzr.exe?")
310 argv0 = exe = bzr_exe
311 else:
312 # otherwise it is 'bzr' itself.
313 import bzrlib
314 # are we running directly from a bzr directory?
315 argv0 = os.path.join(bzrlib.__path__[0], "..", "bzr")
316 if not os.path.isfile(argv0):
317 # maybe from an installed bzr?
318 argv0 = os.path.join(sys.prefix, "scripts", "bzr")
319 if not os.path.isfile(argv0):
320 raise RuntimeError("Can't find a bzr to execute.")
321 exe = old_exe
322 sys.argv[0] = argv0
323 sys.executable = exe
324 # finally get down to business... 299 # finally get down to business...
325 instance = klass()300 instance = klass()
326 invoker(instance, arg_name, filenames, directory, kw)301 invoker(instance, arg_name, filenames, directory, kw)
327 finally:302 finally:
328 sys.argv = old_argv
329 sys.executable = old_exe
330 if need_refresh:303 if need_refresh:
331 refresh_cache(filenames, directory)304 refresh_cache(filenames, directory)
332305

Subscribers

People subscribed via source and target branches