##// END OF EJS Templates
Merge
Bryan O'Sullivan -
r6501:4f7feeb6 merge default
parent child Browse files
Show More
@@ -15,7 +15,7 b' platform-specific details from the core.'
15 from i18n import _
15 from i18n import _
16 import cStringIO, errno, getpass, re, shutil, sys, tempfile
16 import cStringIO, errno, getpass, re, shutil, sys, tempfile
17 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
17 import os, stat, threading, time, calendar, ConfigParser, locale, glob, osutil
18 import urlparse
18 import imp, urlparse
19
19
20 # Python compatibility
20 # Python compatibility
21
21
@@ -563,13 +563,29 b' def _matcher(canonroot, cwd, names, inc,'
563
563
564 _hgexecutable = None
564 _hgexecutable = None
565
565
566 def main_is_frozen():
567 """return True if we are a frozen executable.
568
569 The code supports py2exe (most common, Windows only) and tools/freeze
570 (portable, not much used).
571 """
572 return (hasattr(sys, "frozen") or # new py2exe
573 hasattr(sys, "importers") or # old py2exe
574 imp.is_frozen("__main__")) # tools/freeze
575
566 def hgexecutable():
576 def hgexecutable():
567 """return location of the 'hg' executable.
577 """return location of the 'hg' executable.
568
578
569 Defaults to $HG or 'hg' in the search path.
579 Defaults to $HG or 'hg' in the search path.
570 """
580 """
571 if _hgexecutable is None:
581 if _hgexecutable is None:
572 set_hgexecutable(os.environ.get('HG') or find_exe('hg', 'hg'))
582 hg = os.environ.get('HG')
583 if hg:
584 set_hgexecutable(hg)
585 elif main_is_frozen():
586 set_hgexecutable(sys.executable)
587 else:
588 set_hgexecutable(find_exe('hg', 'hg'))
573 return _hgexecutable
589 return _hgexecutable
574
590
575 def set_hgexecutable(path):
591 def set_hgexecutable(path):
General Comments 0
You need to be logged in to leave comments. Login now