The attached patch makes autogen.sh support Python 3.  However, it
increases the minimal Python requirement from 2.5 to 2.6 for people who
run autogen.sh or build on Windows.  The minimum Python required for
'make check' on Unix is unaffected and remains 2.5.

Python 2.6 was released in 2008, aka, when Subversion 1.5.2 was current.

Okay to bump the minimum?

Daniel

P.S. I didn't test with Python 2.6 since I didn't have a copy handy, but
I tested with 2.7 and confirmed via Python's online docs that the
requisite syntax and library interfaces had been introduced in 2.6.
Index: build/generator/gen_base.py
===================================================================
--- build/generator/gen_base.py	(revision 1659491)
+++ build/generator/gen_base.py	(working copy)
@@ -248,11 +248,11 @@ class GeneratorBase:
     """
 
     try:
-      old_contents = open(fname, 'rb').read()
+      old_contents = open(fname, 'r').read()
     except IOError:
       old_contents = None
     if old_contents != new_contents:
-      open(fname, 'wb').write(new_contents)
+      open(fname, 'w').write(new_contents)
       print("Wrote: %s" % fname)
 
 
Index: build/getversion.py
===================================================================
--- build/getversion.py	(revision 1659491)
+++ build/getversion.py	(working copy)
@@ -64,7 +64,7 @@ def svn_extractor(parser, include_file):
 
   try:
     r = p.parse(include_file)
-  except IOError, e:
+  except IOError as e:
     usage_and_exit(str(e))
   sys.stdout.write("%d.%d.%d" % (r.major, r.minor, r.patch))
 
@@ -75,7 +75,7 @@ def sqlite_extractor(parser, include_file):
 
   try:
     r = p.parse(include_file)
-  except IOError, e:
+  except IOError as e:
     usage_and_exit(str(e))
   major = r.version / 1000000
   minor = (r.version - (major * 1000000)) / 1000
Index: build/transform_sql.py
===================================================================
--- build/transform_sql.py	(revision 1659491)
+++ build/transform_sql.py	(working copy)
@@ -194,7 +194,7 @@ class Processor(object):
             line)
 
       # Another preprocessing.
-      for symbol, string in self.token_map.iteritems():
+      for symbol, string in self.token_map.items():
         # ### This doesn't sql-escape 'string'
         line = re.sub(r'\b%s\b' % re.escape(symbol), "'%s'" % string, line)
 
@@ -201,7 +201,7 @@ class Processor(object):
       if line.strip():
         handled = False
 
-        for regex, handler in self._directives.iteritems():
+        for regex, handler in self._directives.items():
           match = regex.match(line)
           if match:
             handler(match)
Index: gen-make.py
===================================================================
--- gen-make.py	(revision 1659491)
+++ gen-make.py	(working copy)
@@ -38,6 +38,11 @@ except ImportError:
   # Python <3.0
   import ConfigParser as configparser
 
+# TODO: The makefile generator opens our source files in text mode, which
+# depends on the locale.  We should either set the locale to a known value,
+# or teach the makefile generator to open source files as UTF-8 text
+# regardless of locale.
+
 # for the generator modules
 sys.path.insert(0, os.path.join('build', 'generator'))
 
@@ -266,7 +271,7 @@ if __name__ == '__main__':
                             ])
     if len(args) > 1:
       _usage_exit("Too many arguments")
-  except getopt.GetoptError, e:
+  except getopt.GetoptError as e:
     _usage_exit(str(e))
 
   conf = 'build.conf'
Index: subversion/tests/libsvn_subr/subst_translate-test.c
===================================================================
--- subversion/tests/libsvn_subr/subst_translate-test.c	(revision 1659491)
+++ subversion/tests/libsvn_subr/subst_translate-test.c	(working copy)
@@ -115,7 +115,7 @@ test_svn_subst_translate_string2_null_encoding_hel
     svn_string_t *new_value = NULL;
     svn_boolean_t translated_to_utf8 = FALSE;
     svn_boolean_t translated_line_endings = TRUE;
-    /* 'Æ', which is 0xc6 in both ISO-8859-1 and Windows-1252 */
+    /* 'Æ', which is 0xc6 in both ISO-8859-1 and Windows-1252 */
     svn_string_t *source_string = svn_string_create("\xc6", pool);
 
     SVN_ERR(svn_subst_translate_string2(&new_value, &translated_to_utf8,

Reply via email to