Merge lp:~bialix/bzr/lp-bzr.exe into lp:~bzr/bzr/trunk-old

Proposed by Alexander Belchenko
Status: Merged
Approved by: Wouter van Heyst
Approved revision: no longer in the source branch.
Merged at revision: not available
Proposed branch: lp:~bialix/bzr/lp-bzr.exe
Merge into: lp:~bzr/bzr/trunk-old
Diff against target: 21 lines
To merge this branch: bzr merge lp:~bialix/bzr/lp-bzr.exe
Reviewer Review Type Date Requested Status
Alexander Belchenko Approve
Andrew Bennetts Approve
Jonathan Lange Pending
Review via email: mp+8259@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexander Belchenko (bialix) wrote :

Better support for bzr.exe: `import webbrowser` should not be lazy.

Revision history for this message
Robert Collins (lifeless) wrote :

On Mon, 2009-07-06 at 13:05 +0000, Alexander Belchenko wrote:
> Alexander Belchenko has proposed merging lp:~bialix/bzr/lp-bzr.exe into lp:bzr.
>
> Requested reviews:
> Jonathan Lange (jml)
> bzr-core (bzr-core)
>
> Better support for bzr.exe: `import webbrowser` should not be lazy.

This penalises every execution of bzr.

Is there some other way to make bzr.exe include the module?

Revision history for this message
Andrew Bennetts (spiv) wrote :

Robert Collins wrote:
> On Mon, 2009-07-06 at 13:05 +0000, Alexander Belchenko wrote:
> > Alexander Belchenko has proposed merging lp:~bialix/bzr/lp-bzr.exe into lp:bzr.
> >
> > Requested reviews:
> > Jonathan Lange (jml)
> > bzr-core (bzr-core)
> >
> > Better support for bzr.exe: `import webbrowser` should not be lazy.
>
> This penalises every execution of bzr.

Actually, it doesn't; it's only imported inside cmd_launchpad_open.run
immediately before it is used. So it's still lazy, it's just not using
lazy_import. So to be pedantic, it improves every execution of bzr, because it
creates one less lazy-proxy object ;)

It would be nice if whatever builds bzr.exe worked just fine with lazy_import,
but this patch seems ok to me.

 review approve

-Andrew.

review: Approve
Revision history for this message
Robert Collins (lifeless) wrote :

On Tue, 2009-07-07 at 02:45 +0000, Andrew Bennetts wrote:

> Actually, it doesn't; it's only imported inside cmd_launchpad_open.run
> immediately before it is used. So it's still lazy, it's just not using
> lazy_import. So to be pedantic, it improves every execution of bzr, because it
> creates one less lazy-proxy object ;)
>
> It would be nice if whatever builds bzr.exe worked just fine with lazy_import,
> but this patch seems ok to me.

good point, and agreed.

-Rob

Revision history for this message
Alexander Belchenko (bialix) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bzrlib/plugins/launchpad/__init__.py'
2--- bzrlib/plugins/launchpad/__init__.py 2009-07-03 08:57:53 +0000
3+++ bzrlib/plugins/launchpad/__init__.py 2009-07-07 11:36:11 +0000
4@@ -26,8 +26,6 @@
5
6 from bzrlib.lazy_import import lazy_import
7 lazy_import(globals(), """
8-import webbrowser
9-
10 from bzrlib import (
11 branch as _mod_branch,
12 trace,
13@@ -196,6 +194,8 @@
14 web_url = self._get_web_url(LaunchpadService(), location)
15 trace.note('Opening %s in web browser' % web_url)
16 if not dry_run:
17+ import webbrowser # this import should not be lazy
18+ # otherwise bzr.exe lacks this module
19 webbrowser.open(web_url)
20
21 register_command(cmd_launchpad_open)