i18n/hggettext
changeset 8626 1fc1c77d4863
parent 8542 de150a942ec8
child 9539 c904e76e3834
--- 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)