예제 #1
0
 def __init__(self, do_sanity_checks = True):
     self.hostname = _gethostname()
     self.user = _getuser()                         
     
     self.is64bit = _architecture()[0] == '64bit'
     self.is32bit = _architecture()[0] == '32bit'
     if do_sanity_checks:
         # sanity check
         if self.is64bit + self.is32bit != 1:
             raise ValueError(_architecture()[0])
        
     self.has_good_gpu_card = True # Let's be optimistic.
예제 #2
0
    def host(self):
        host = self.address

        if host in ("0.0.0.0", "::", ""):
            # 0.0.0.0 is INADDR_ANY and :: is IN6ADDR_ANY.
            # Look up the host name, which should be the
            # safest thing to spit out in a URL.
            host = _gethostname()

        ssl = self.ssl
        port = self.port

        if not ((ssl and port == 443) or (not ssl and port == 80)):
            host = "%s:%s" % (host, port)

        return host
예제 #3
0
파일: servers.py 프로젝트: jonnenauha/naali
    def host(self):
        host = self.address

        if host in ("0.0.0.0", "::", ""):
            # 0.0.0.0 is INADDR_ANY and :: is IN6ADDR_ANY.
            # Look up the host name, which should be the
            # safest thing to spit out in a URL.
            host = _gethostname()

        ssl = self.ssl
        port = self.port

        if not ((ssl and port == 443) or (not ssl and port == 80)):
            host = "%s:%s" % (host, port)

        return host
예제 #4
0
def _get_repo_ip():
    '''
    Get the IP of the this host.
    '''
    return _gethostbyname(_gethostname())