Merge lp:~vila/bzr-gtk/388790-windows-setup into lp:bzr-gtk/gtk2

Proposed by Vincent Ladeuil
Status: Merged
Merge reported by: Vincent Ladeuil
Merged at revision: not available
Proposed branch: lp:~vila/bzr-gtk/388790-windows-setup
Merge into: lp:bzr-gtk/gtk2
Diff against target: 31 lines (+14/-1)
1 file modified
__init__.py (+14/-1)
To merge this branch: bzr merge lp:~vila/bzr-gtk/388790-windows-setup
Reviewer Review Type Date Requested Status
GuilhemBichot (community) Approve
Alexander Belchenko Approve
Bazaar GTK maintainers Pending
Review via email: mp+15541@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Vincent Ladeuil (vila) wrote :

This is a cleaned up version of the patch proposed in https://bugs.edge.launchpad.net/bzr/+bug/388790.

Guilhem, can you test it again on the two cited envs (Vladislav's and yours) and report here.

Bialix, can you comment again about the validity of the approach (the path needs to be tweaked for bzr.exe *only*) ?

If no bzr-gtk dev objects, I'll land this patch as soon as I get confirmation from both of you plus a little delay (for objections).

Revision history for this message
Alexander Belchenko (bialix) wrote :

Yes, that's correct, sys.path manipulations needed only for bzr.exe. This approach assumes that all extra libs required for <email address hidden> is placed in _lib subdirectory inside directory where plugin resides.

And:

#sys.path.append(here)

^-- yep, you really don't need this append. I dunno why it was there.

review: Approve
Revision history for this message
Vincent Ladeuil (vila) wrote :

> Yes, that's correct, sys.path manipulations needed only for bzr.exe. This
> approach assumes that all extra libs required for <email address hidden> is placed in
> _lib subdirectory inside directory where plugin resides.

Oh my, I understand the intent now :-(
So that's really a workaround waiting for a better windows packaging that can provide
the needed gtk libraries, I'll add a comment to clarify that.

>
> And:
>
> #sys.path.append(here)
>
> ^-- yep, you really don't need this append. I dunno why it was there.

Ok. Good.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Vincent Ladeuil пишет:
>> Yes, that's correct, sys.path manipulations needed only for bzr.exe. This
>> approach assumes that all extra libs required for <email address hidden> is placed in
>> _lib subdirectory inside directory where plugin resides.
>
> Oh my, I understand the intent now :-(

And why it makes you sad? We did this for QBzr for couple of years long
before QBzr was accepted to be a part of TortoiseBzr and therefore
starting bundled into bzr.exe installer.

> So that's really a workaround waiting for a better windows packaging that can provide
> the needed gtk libraries, I'll add a comment to clarify that.

To be clear, yes, this is workaround, and it required not only for
bzr-gtk. But for bzr-git as well, and many other plugins which dare to
use some extra libs. This is how py2exe worked. There is nothing special
about bzr-gtk. We all in the same boat.

But please, don't start the thread about "bzr.exe must die". Pretty please.

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4469 (20090930) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru

Revision history for this message
GuilhemBichot (guilhem-bichot) wrote :

Vladislav Vaintroub my colleague and me confirm that the patch works. I branched Vincent's bzr-gtk branch into my plugins directory, also put there (inside bzr-gtk) the _lib directory found in Kevin Light's package (available at http://bazaar-vcs.org/bzr-gtk?action=show&redirect=BzrGtk), and then gannotate/viz/gcommit work.
Vincent: about what your patch does. We had observed that when using the standalone bzr Windows installer, bzr-gtk cannot find pygtk (even though pygtk is properly installed). Looks like that version of bzr cannot look for modules out of certain predefined places. Kevin Light's solution is
1) to bundle pygtk and other modules in one directory (makes a quicker install than installing pygtk, pygobject, etc etc)
2) to instruct bzr to look into that directory (which is done through a patch to bzr-gtk adding the directory to the search path).
He created a patched version of bzr-gtk available at http://bazaar-vcs.org/bzr-gtk?action=show&redirect=BzrGtk, but that is based on bzr-gtk 0.96. And it's annoying to have to use the old 0.96 for us.
With your patch, we can use Kevin's approach (put a _lib directory when you install) but without using 0.96: we can do it with the bzr-gtk dev branch, which is better.

Revision history for this message
Alexander Belchenko (bialix) wrote :

Guilhem, bzr.exe can't find pygtk because it working with bundled python interpreter and therefore even don't try to find your installed Python. Therefore you need to place any extra libs to _lib.

Revision history for this message
GuilhemBichot (guilhem-bichot) wrote :

Alexander: yes, this is what we are doing and it works :-)

Revision history for this message
Alexander Belchenko (bialix) wrote :

Yes, I know that it works, we do the same in qbzr. I'm just trying to explain why bzr.exe "can't" find installed pygtk.

Revision history for this message
GuilhemBichot (guilhem-bichot) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '__init__.py'
2--- __init__.py 2009-09-17 14:35:47 +0000
3+++ __init__.py 2009-12-02 11:30:24 +0000
4@@ -34,6 +34,20 @@
5 visualise Graphically visualise this branch.
6 """
7
8+import os
9+import sys
10+
11+if getattr(sys, "frozen", None) is not None: # we run bzr.exe
12+ # NOTE: _lib must be ahead of bzrlib or sax.saxutils (in olive) fails
13+ here = os.path.dirname(__file__)
14+ sys.path.insert(0, os.path.join(here, '_lib'))
15+ sys.path.append(os.path.join(here, '_lib/gtk-2.0'))
16+ # Do we really need the following (since we are executing that code, we
17+ # should already be on the path at the appropriate place, I'm concerned
18+ # about masking import bugs by adding that)? Can someone test and report?
19+ #sys.path.append(here)
20+
21+
22 import bzrlib
23 import bzrlib.api
24 from bzrlib import (
25@@ -43,7 +57,6 @@
26 )
27 from bzrlib.commands import plugin_cmds
28
29-import os.path
30
31 version_info = (0, 98, 0, 'dev', 1)
32

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: