src/mercurialserver/config.py
changeset 217 32b431977bf9
parent 216 0122df83ebd0
child 225 ff08fd5b1a62
equal deleted inserted replaced
216:0122df83ebd0 217:32b431977bf9
     1 # Copyright 2008-2009 LShift Ltd
     1 # Copyright 2008-2009 LShift Ltd
     2 
     2 
     3 import sys
     3 import sys
       
     4 import os
     4 import os.path
     5 import os.path
       
     6 import pwd
     5 import ConfigParser
     7 import ConfigParser
     6 
     8 
     7 globalconfig = None
     9 globalconfig = None
     8 
    10 
     9 def _getConf():
    11 def _getConf():
    34 def getAccessPaths(): return _getPaths("access")
    36 def getAccessPaths(): return _getPaths("access")
    35 
    37 
    36 def getEnv(): return _getConf().items("env")
    38 def getEnv(): return _getConf().items("env")
    37 
    39 
    38 # Work out where we are, don't use config.
    40 # Work out where we are, don't use config.
    39 def setExePath():
    41 def initExe():
    40     global _exePath
    42     global _exePath
    41     _exePath = os.path.dirname(os.path.abspath(sys.argv[0]))
    43     _exePath = os.path.dirname(os.path.abspath(sys.argv[0]))
       
    44     # Fix $HOME in case of "sudo -u hg refresh-auth"
       
    45     os.environ['HOME'] = pwd.getpwuid(os.geteuid()).pw_dir
    42 
    46 
    43 def getExePath():
    47 def getExePath():
    44     return _exePath
    48     return _exePath
    45 
    49