[PATCH] Force pygments package to be loaded in py2exe

Pascal Quantin pascal.quantin at gmail.com
Tue Jan 27 16:18:09 CST 2009

Matt Mackall a écrit :
> On Tue, 2009-01-27 at 22:42 +0100, Pascal Quantin wrote:
>> # HG changeset patch
>> # User Pascal Quantin <pascal.quantin at gmail.com>
>> # Date 1233089606 -3600
>> # Node ID 87d4115806b006f9080eb5c36958274feb023ac9
>> # Parent  97b55cce3100d3b408cda75b96dabdd5be92dd6a
>> Force pygments package to be loaded in py2exe
>> Like with email package, the pygments package is not fully loaded by py2exe due to Python2.5 dynamic imports which are not found by modulefinder. This breaks the highlight extension.
>> -> Force the pygments package to be included if installed so that the dynamic imports work as expected.
> Dunno. The difference is that the packages in email are standard Python
> bits, where pygments is not. 
> I don't think we want builds to quietly change based on what third-party
> packages happen to be installed. We certainly don't do this on the Unix
> side of the fence.
> Is it not possible to download and install pygments separately?

in fact my title is wrong and should be read "Force pygments package to 
be loaded in py2exe if present".
As pygments is used by the highlight extension bundled with mercurial, 
the idea is to force explicitly its inclusion in py2exe if pygments is 
present in python installation path.
Without this patch, trying to use highlight extension after compiling a 
hg.exe with py2exe and pygments installed leads to a "error: no module 
named text" failure.
If pygments is not installed, then the py2exe package works as previously.
If you agree with this change, I will send a new patch addressing 
Benoit's comments


More information about the Mercurial-devel mailing list