Suggestion - add a "Local library" directory for hg binary package
p.f.moore at gmail.com
Wed Mar 19 10:52:56 CDT 2008
On 18/03/2008, Paul Moore <p.f.moore at gmail.com> wrote:
> Would it be reasonable to add an extra directory to sys.path when
> Mercurial is run from a frozen executable? Specifically, in the
> Windows binary, add a "Library" directory alongside hg.exe which is
> added to sys.path. Then, extensions like convert which require the
> Python svn bindings can work by installing the bindings in the
> "Library" directory.
> If the idea seems reasonable, I'll put together a patch. It would be
> nice to get this in for 1.0.
I have an initial patch. There's one (minor) issue, and one (obscure) one.
The minor one is that the py2exe options currently used to build the
Windows binary include "-b 1" which bundles python2x.dll into the exe
and as a result, makes it impossible for "external" DLLs (such as the
ones in the Python Subversion bindings) to link to python2x.dll. This
is resolved by using "-b 2", which means that the distribution
contains a couple more files, but otherwise seems harmless. Would this
The obscure one is that finding the directory containing the Mercurial
executable is somewhat unreliable. mercurial.uitl.hgexecutable can
give the wrong answer for uninstalled copies, necessitating the use of
the HG environment variable. Rather than worry too much about getting
the wrong directory, I propose to only add the library directory for
frozen binaries (ie, the Windows binary installer), where I can use
sys.executable. As other installation types can probably have external
modules added easily in any case, would this be acceptable?
PS I've tested with the Subversion bindings and the convert extension.
It works fine, although I'm surprised at how fragile the Python
Subversion bindings seem to be. Converting a big repository certainly
isn't going to be a trivial operation...
More information about the Mercurial