Bugzilla – Bug 835
make build script work correctly with python 2.5
Last modified: 2011-05-17 17:07:16 CEST
The fix to the build script for bug 818 only works in a Python 2.6 environment, because it depends on on a 'timeout' argument to urllib2.urlopen(...), which is new in python 2.6. So it won't work in a python 2.5 environment. The following patch fixes it. diff -r b893eb8c0260 build.py --- a/build.py Sat Feb 12 20:51:26 2011 +0000 +++ b/build.py Tue May 17 17:35:45 2011 +0900 @@ -25,6 +25,7 @@ import shutil import httplib import urllib2 +import socket import re try: from hashlib import md5 @@ -643,14 +644,18 @@ # 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: try: - f = urllib2.urlopen(url, timeout=httpTimeoutSeconds) + socket.setdefaulttimeout(httpTimeoutSeconds) + f = urllib2.urlopen(url) data = f.read() f.close() completed = True except httplib.BadStatusLine, e: print "received error, retrying" + finally: + socket.setdefaulttimeout(defaultTimeout) if md5sum: m = md5(data) if md5sum != m.hexdigest():
https://bitbucket.org/validator/build/changeset/c395ef1f0c44