Comment 14 for bug 388790

Revision history for this message
Alexander Belchenko (bialix) wrote : Re: [Bug 388790] Re: problems with bzr.exe vs Python-based installers

GuilhemBichot пишет:
> For what it's worth, we have had two successful setups with the standalone bzr installer and bzr-gtk and a tweak. My colleague Vladislav Vaintroub reused Kevin Light's idea of patching bzr-gtk and adding libraries to it (look in http://bazaar-vcs.org/bzr-gtk?action=show&redirect=BzrGtk : "Windows packages by Kevin Light can be found at http://d5190871.u44.websitesource.net/bzr-gtk/" ), but he did it with the bzr-gtk trunk (whereas Kevin's package has bzr-gtk 0.96):
> 1) install the standalone bzr installer
> 2) install bzr-gtk's trunk into plugins/gtk
> 3) at this point bzr-gtk doesn't work yet
> 4) patch plugins/gtk/__init__.py like done in Kevin Light's package:
> === modified file '__init__.py'
> --- __init__.py 2009-09-17 14:35:47 +0000
> +++ __init__.py 2009-11-17 10:57:28 +0000
> @@ -34,6 +34,14 @@
> visualise Graphically visualise this branch.
> """
>
> +import sys
> +
> +import os.path
> +# NOTE: _lib must be ahead of bzrlib or sax.saxutils (in olive) fails
> +sys.path.insert(0, os.path.join(os.path.dirname(__file__), '_lib'))
> +sys.path.append(os.path.join(os.path.dirname(__file__), '_lib/gtk-2.0'))
> +sys.path.append(os.path.dirname(__file__))
> +
> import bzrlib
> import bzrlib.api
> from bzrlib import (

This is right way to go, but I'd suggest to make it more universal with
following construct in the patch above:

import sys

if getattr(sys, "frozen", None) is not None: # we run bzr.exe
     import os
     # NOTE: _lib must be ahead of bzrlib or sax.saxutils (in olive) fails
     sys.path.insert(0, os.path.join(os.path.dirname(__file__), '_lib'))
     sys.path.append(os.path.join(os.path.dirname(__file__),
'_lib/gtk-2.0'))
     sys.path.append(os.path.dirname(__file__))

Now it's ready to propose it as patch for bzr-gtk trunk ;-)