pld-builder.new: PLD_Builder/rpm_builder.py - python 2.4 compat

glen glen at pld-linux.org
Mon May 21 21:02:25 CEST 2012


Author: glen                         Date: Mon May 21 19:02:25 2012 GMT
Module: pld-builder.new               Tag: HEAD
---- Log message:
- python 2.4 compat

---- Files affected:
pld-builder.new/PLD_Builder:
   rpm_builder.py (1.131 -> 1.132) 

---- Diffs:

================================================================
Index: pld-builder.new/PLD_Builder/rpm_builder.py
diff -u pld-builder.new/PLD_Builder/rpm_builder.py:1.131 pld-builder.new/PLD_Builder/rpm_builder.py:1.132
--- pld-builder.new/PLD_Builder/rpm_builder.py:1.131	Mon May 14 14:12:06 2012
+++ pld-builder.new/PLD_Builder/rpm_builder.py	Mon May 21 21:02:20 2012
@@ -64,10 +64,16 @@
             f = urllib2.urlopen(req)
             good = True
         except urllib2.HTTPError, error:
-                return False
+            return False
         except urllib2.URLError, error:
             # see errno.h
-            if error.errno in [-3, 60, 61, 110, 111]:
+            try:
+                errno = error.errno
+            except AttributeError:
+                # python 2.4
+                errno = error.reason[0]
+
+            if errno in [-3, 60, 61, 110, 111]:
                 b.log_line("unable to connect... trying again")
                 continue
             else:
@@ -101,7 +107,13 @@
                 return False
         except urllib2.URLError, error:
             # see errno.h
-            if error.errno in [-3, 60, 61, 110, 111]:
+            try:
+                errno = error.errno
+            except AttributeError:
+                # python 2.4
+                errno = error.reason[0]
+
+            if errno in [-3, 60, 61, 110, 111]:
                 b.log_line("unable to connect to %s... trying again" % (src_url))
                 continue
             else:
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/pld-builder.new/PLD_Builder/rpm_builder.py?r1=1.131&r2=1.132



More information about the pld-cvs-commit mailing list