mercurial/util.py
changeset 22633 92b54547ac5d
parent 22632 db15bb2d6323
child 22638 0d0350cfc7ab
--- a/mercurial/util.py	Sun Sep 28 16:57:06 2014 +0200
+++ b/mercurial/util.py	Sun Sep 28 16:57:06 2014 +0200
@@ -460,6 +460,13 @@
             safehasattr(sys, "importers") or # old py2exe
             imp.is_frozen("__main__")) # tools/freeze
 
+# the location of data files matching the source code
+if mainfrozen():
+    # executable version (py2exe) doesn't support __file__
+    datapath = os.path.dirname(sys.executable)
+else:
+    datapath = os.path.dirname(__file__)
+
 _hgexecutable = None
 
 def hgexecutable():