mercurial/util.py
changeset 14228 116de1da2154
parent 14167 0e4753807c93
child 14229 85fd8402cbc4
equal deleted inserted replaced
14227:94985b5a8278 14228:116de1da2154
   295     b.reverse()
   295     b.reverse()
   296     return os.sep.join((['..'] * len(a)) + b) or '.'
   296     return os.sep.join((['..'] * len(a)) + b) or '.'
   297 
   297 
   298 _hgexecutable = None
   298 _hgexecutable = None
   299 
   299 
   300 def main_is_frozen():
   300 def mainfrozen():
   301     """return True if we are a frozen executable.
   301     """return True if we are a frozen executable.
   302 
   302 
   303     The code supports py2exe (most common, Windows only) and tools/freeze
   303     The code supports py2exe (most common, Windows only) and tools/freeze
   304     (portable, not much used).
   304     (portable, not much used).
   305     """
   305     """
   314     """
   314     """
   315     if _hgexecutable is None:
   315     if _hgexecutable is None:
   316         hg = os.environ.get('HG')
   316         hg = os.environ.get('HG')
   317         if hg:
   317         if hg:
   318             set_hgexecutable(hg)
   318             set_hgexecutable(hg)
   319         elif main_is_frozen():
   319         elif mainfrozen():
   320             set_hgexecutable(sys.executable)
   320             set_hgexecutable(sys.executable)
   321         else:
   321         else:
   322             exe = find_exe('hg') or os.path.basename(sys.argv[0])
   322             exe = find_exe('hg') or os.path.basename(sys.argv[0])
   323             set_hgexecutable(exe)
   323             set_hgexecutable(exe)
   324     return _hgexecutable
   324     return _hgexecutable
  1197 
  1197 
  1198     This is different from hgexecutable() because on Windows we want
  1198     This is different from hgexecutable() because on Windows we want
  1199     to avoid things opening new shell windows like batch files, so we
  1199     to avoid things opening new shell windows like batch files, so we
  1200     get either the python call or current executable.
  1200     get either the python call or current executable.
  1201     """
  1201     """
  1202     if main_is_frozen():
  1202     if mainfrozen():
  1203         return [sys.executable]
  1203         return [sys.executable]
  1204     return gethgcmd()
  1204     return gethgcmd()
  1205 
  1205 
  1206 def rundetached(args, condfn):
  1206 def rundetached(args, condfn):
  1207     """Execute the argument list in a detached process.
  1207     """Execute the argument list in a detached process.