How to install Python modules needed by plugins?
Eli Zaretskii
eliz at gnu.org
Wed Mar 9 10:52:31 UTC 2011
> Date: Wed, 09 Mar 2011 12:48:10 +0200
> From: Alexander Belchenko <bialix at ukr.net>
> CC: bazaar at lists.canonical.com
>
> >>>> C:\Program Files\Bazaar\site-packages
> >>>>
> >>>> I don't know if it can easily be done as part of bzr-windows-installers.
> >>>> But certainly we could put in 'bzr':
> >>>>
> >>>> if sys.frozen and sys.platform == 'windows':
> >>>> sys.path.append(os.path.join(os.path.dirname(sys.executable),
> >>>> 'site-packages'))
> >>> Excuse me my ignorance, but why something like that is not already
> >>> working?
> >> "like that" - like what?
> >
> > Like bzr (or its Python interpreter) looking in site-packages
> > subdirectory of some directory.
>
> That's a Python interpreter magic. py2exed application has different
> kind of sys.path magic inside.
I see.
> >> #------------
> >> import sys
> >> print sys.path
> >> #------------
> >>
> >> And run any bzr command, e.g. `bzr rocks` and you will see what bzr.exe
> >> puts into sys.path
> >
> > Thanks for this. I wish I knew this trick a few days ago, then I'd
> > realized much sooner that library.zip is my only chance.
>
> Sorry, I haven't had a chance to answer yesterday.
No sweat, we all have our lives.
> Actually we can mangle sys.path for bzr.exe using plugin, but we need to
> put it first in the loading list, so let's name it a.py:
>
> #-----------------------------------------------------------------
> if getattr(sys, 'frozen', None) is not None:
> sys.path.append(os.path.join(os.path.dirname(sys.executable),
> 'site-packages'))
> #-----------------------------------------------------------------
>
> And after that you should be able to put extra python libs into
> C:\Program Files\Bazaar\site-packages
Right, another excellent advice.
More information about the bazaar
mailing list