1. Michael[tm] Smith
  2. vnu


Michael[tm] Smith  committed c395ef1

Make build script work with Python 2.5. rs=hsivonen

  • Participants
  • Parent commits b893eb8
  • Branches default

Comments (0)

Files changed (1)

File build.py

View file
 import shutil
 import httplib
 import urllib2
+import socket
 import re
   from hashlib import md5
   # I bet there's a way to do this with more efficient IO and less memory
   print url
   completed = False
+  defaultTimeout = socket.getdefaulttimeout()
   while not completed:
-    f = urllib2.urlopen(url, timeout=httpTimeoutSeconds)
+    socket.setdefaulttimeout(httpTimeoutSeconds)
+    f = urllib2.urlopen(url)
     data = f.read()
     completed = True
    except httplib.BadStatusLine, e:
     print "received error, retrying"
+   finally:
+    socket.setdefaulttimeout(defaultTimeout)
   if md5sum:
     m = md5(data)
     if md5sum != m.hexdigest():