# HG changeset patch # User Martin Geisler # Date 1243361557 -7200 # Node ID 1fc1c77d4863ea135cc4b62a3319931fd95661b3 # Parent 34754aa62cd8798316ad2335e7a41dc4504e1068 hggettext: ensure correct Mercurial is imported diff -r 34754aa62cd8 -r 1fc1c77d4863 i18n/hggettext --- a/i18n/hggettext Tue May 26 19:51:22 2009 +0200 +++ b/i18n/hggettext Tue May 26 20:12:37 2009 +0200 @@ -20,8 +20,7 @@ join the message cataloges to get the final catalog. """ -from mercurial import demandimport; demandimport.enable() -import sys, inspect +import os, sys, inspect def escape(s): @@ -114,5 +113,11 @@ if __name__ == "__main__": + # It is very important that we import the Mercurial modules from + # the source tree where hggettext is executed. Otherwise we might + # accidentally import and extract strings from a Mercurial + # installation mentioned in PYTHONPATH. + sys.path.insert(0, os.getcwd()) + from mercurial import demandimport; demandimport.enable() for path in sys.argv[1:]: docstrings(path)