##// END OF EJS Templates
Added hgexecutable support for py2exe/frozen scripts
"Paul Moore " -
r6499:479847cc default
parent child Browse files
Show More
@@ -15,7 +15,7 b' platform-specific details from the core.'
15 15 from i18n import _
16 16 import cStringIO, errno, getpass, popen2, re, shutil, sys, tempfile, strutil
17 17 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
18 import re, urlparse
18 import re, urlparse, imp
19 19
20 20 try:
21 21 set = set
@@ -553,13 +553,28 b' def _matcher(canonroot, cwd, names, inc,'
553 553
554 554 _hgexecutable = None
555 555
556 def main_is_frozen():
557 """return True if we are a frozen executable.
558
559 The code supports py2exe (most common, Windows only) and tools/freeze
560 (portable, not much used).
561 """
562 return (hasattr(sys, "frozen") or # new py2exe
563 hasattr(sys, "importers") or # old py2exe
564 imp.is_frozen("__main__")) # tools/freeze
565
556 566 def hgexecutable():
557 567 """return location of the 'hg' executable.
558 568
559 569 Defaults to $HG or 'hg' in the search path.
560 570 """
561 571 if _hgexecutable is None:
562 set_hgexecutable(os.environ.get('HG') or find_exe('hg', 'hg'))
572 if os.environ.has_key('HG'):
573 set_hgexecutable(os.environ.get('HG'))
574 elif main_is_frozen():
575 set_hgexecutable(sys.executable)
576 else:
577 sel_hgexecutable(find_exe('hg', 'hg'))
563 578 return _hgexecutable
564 579
565 580 def set_hgexecutable(path):
General Comments 0
You need to be logged in to leave comments. Login now