mercurial/hgweb.py
changeset 896 01215ad04283
parent 858 c333dfa8fa1a
parent 895 77b52b864249
child 937 e4f1b76831b2
child 945 f15901d053e1
--- a/mercurial/hgweb.py
+++ b/mercurial/hgweb.py
@@ -708,7 +708,12 @@ def create_server(path, name, templates,
     import BaseHTTPServer
 
     class IPv6HTTPServer(BaseHTTPServer.HTTPServer):
-        address_family = socket.AF_INET6
+        address_family = getattr(socket, 'AF_INET6', None)
+
+        def __init__(self, *args, **kwargs):
+            if self.address_family is None:
+                raise RepoError('IPv6 not available on this system')
+            BaseHTTPServer.HTTPServer.__init__(self, *args, **kwargs)
 
     class hgwebhandler(BaseHTTPServer.BaseHTTPRequestHandler):
         def log_error(self, format, *args):