Support for Python 3.0, drop support for pre-2.0.
authorJohan Dahlin <jdahlin@async.com.br>
Sun, 26 Oct 2008 09:28:40 +0000 (10:28 +0100)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sun, 26 Oct 2008 09:33:32 +0000 (10:33 +0100)
* lib/py-compile: Do not import string; use sys.stdout.write
instead of print, files.split instead of string.split.
* m4/python.m4 (AM_PATH_PYTHON): Also look for python3 and
phython3.0; do not look for python1.5.  Use sys.stdout.write.
(AM_PYTHON_CHECK_VERSION): Do not use string; adjust to xrange
removal in Python 3.0, and changed semantics of map.
* doc/automake.texi (Python, Hard-Coded Install Paths): Update
Python versions mentioned in the manual, using 2.5 everywhere.
* NEWS, THANKS: Update.

Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
ChangeLog
NEWS
THANKS
doc/automake.texi
lib/py-compile
m4/python.m4

index 0037946..2c0a326 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-10-26  Johan Dahlin  <jdahlin@async.com.br>
+
+       Support for Python 3.0, drop support for pre-2.0.
+       * lib/py-compile: Do not import string; use sys.stdout.write
+       instead of print, files.split instead of string.split.
+       * m4/python.m4 (AM_PATH_PYTHON): Also look for python3 and
+       phython3.0; do not look for python1.5.  Use sys.stdout.write.
+       (AM_PYTHON_CHECK_VERSION): Do not use string; adjust to xrange
+       removal in Python 3.0, and changed semantics of map.
+       * doc/automake.texi (Python, Hard-Coded Install Paths): Update
+       Python versions mentioned in the manual, using 2.5 everywhere.
+       * NEWS, THANKS: Update.
+
 2008-10-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        * lib/Automake/Channels.pm (@chain): Drop unused variable.
diff --git a/NEWS b/NEWS
index 1a14ec6..42107a2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,9 @@ New in 1.10a:
 
   - Files with extension .sx are also treated as preprocessed assembler.
 
+  - Python 3.0 is supported now, Python releases prior to 2.0 are no
+    longer supported.
+
 * Miscellaneous changes:
 
   - Automake development is done in a git repository on Savannah now, see
diff --git a/THANKS b/THANKS
index 18a1ece..f79a7a0 100644 (file)
--- a/THANKS
+++ b/THANKS
@@ -142,6 +142,7 @@ Jim Meyering                meyering@na-net.ornl.gov
 Jochen Kuepper         jochen@uni-duesseldorf.de
 Joel N. Weber II       nemo@koa.iolani.honolulu.hi.us
 Joerg-Martin Schwarz   jms@jms.prima.ruhr.de
+Johan Dahlin           jdahlin@async.com.br
 Johan Danielsson       joda@pdc.kth.se
 Johannes Nicolai       johannes.nicolai@student.hpi.uni-potsdam.de
 John F Trudeau         JohnTrudeau@firsthealth.com
index c2e0be5..122b977 100644 (file)
@@ -7380,11 +7380,11 @@ AM_PATH_PYTHON([2.2])
 
 @noindent
 This is fine when Python is an absolute requirement for the package.
-If Python >= 2.2 was only @emph{optional} to the package,
+If Python >= 2.5 was only @emph{optional} to the package,
 @code{AM_PATH_PYTHON} could be called as follows.
 
 @example
-AM_PATH_PYTHON([2.2],, [:])
+AM_PATH_PYTHON([2.5],, [:])
 @end example
 
 @code{AM_PATH_PYTHON} creates the following output variables based on
@@ -7408,7 +7408,7 @@ as follows.
 
 @item PYTHON_VERSION
 The Python version number, in the form @var{major}.@var{minor}
-(e.g., @samp{1.5}).  This is currently the value of
+(e.g., @samp{2.5}).  This is currently the value of
 @samp{sys.version[:3]}.
 
 @item PYTHON_PREFIX
@@ -10983,7 +10983,7 @@ where to install the library, it will answer something like this:
 @example
 % @kbd{python -c 'from distutils import sysconfig;
              print sysconfig.get_python_lib(1,0)'}
-/usr/lib/python2.3/site-packages
+/usr/lib/python2.5/site-packages
 @end example
 
 If you indeed use this absolute path to install your shared library,
@@ -10997,7 +10997,7 @@ installation prefix.
 @example
 % @kbd{python -c 'from distutils import sysconfig;
              print sysconfig.get_python_lib(1,0,"$@{exec_prefix@}")'}
-$@{exec_prefix@}/lib/python2.3/site-packages
+$@{exec_prefix@}/lib/python2.5/site-packages
 @end example
 
 You can also use this new path.  If you do
index 865cda8..88776bc 100755 (executable)
@@ -1,9 +1,10 @@
 #!/bin/sh
 # py-compile - Compile a Python program
 
-scriptversion=2005-05-14.22
+scriptversion=2008-10-26.11
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008  Free Software
+# Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -101,38 +102,38 @@ else
 fi
 
 $PYTHON -c "
-import sys, os, string, py_compile
+import sys, os, py_compile
 
 files = '''$files'''
 
-print 'Byte-compiling python modules...'
-for file in string.split(files):
+sys.stdout.write('Byte-compiling python modules...\n')
+for file in files.split():
     $pathtrans
     $filetrans
     if not os.path.exists(filepath) or not (len(filepath) >= 3
                                             and filepath[-3:] == '.py'):
-       continue
-    print file,
+           continue
+    sys.stdout.write(file)
     sys.stdout.flush()
     py_compile.compile(filepath, filepath + 'c', path)
-print" || exit $?
+sys.stdout.write('\n')" || exit $?
 
 # this will fail for python < 1.5, but that doesn't matter ...
 $PYTHON -O -c "
-import sys, os, string, py_compile
+import sys, os, py_compile
 
 files = '''$files'''
-print 'Byte-compiling python modules (optimized versions) ...'
-for file in string.split(files):
+sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
+for file in files.split():
     $pathtrans
     $filetrans
     if not os.path.exists(filepath) or not (len(filepath) >= 3
                                             and filepath[-3:] == '.py'):
-       continue
-    print file,
+           continue
+    sys.stdout.write(file)
     sys.stdout.flush()
     py_compile.compile(filepath, filepath + 'o', path)
-print" 2>/dev/null || :
+sys.stdout.write('\n')" 2>/dev/null || :
 
 # Local Variables:
 # mode: shell-script
index 229fd55..3adf87b 100644 (file)
@@ -3,7 +3,7 @@
 ## From Andrew Dalke
 ## Updated by James Henstridge
 ## ------------------------
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # numbers and dots only.
 AC_DEFUN([AM_PATH_PYTHON],
  [
-  dnl Find a Python interpreter.  Python versions prior to 1.5 are not
-  dnl supported because the default installation locations changed from
-  dnl $prefix/lib/site-python in 1.4 to $prefix/lib/python1.5/site-packages
-  dnl in 1.5.
+  dnl Find a Python interpreter.  Python versions prior to 2.0 are not
+  dnl supported. (2.0 was released on October 16, 2000).
   m4_define_default([_AM_PYTHON_INTERPRETER_LIST],
-                    [python python2 python2.5 python2.4 python2.3 python2.2 dnl
-python2.1 python2.0 python1.6 python1.5])
+                    [python python2 python3 python3.0 python2.5 python2.4 python2.3 python2.2 dnl
+python2.1 python2.0])
 
   m4_if([$1],[],[
     dnl No version check is needed.
@@ -87,7 +85,7 @@ python2.1 python2.0 python1.6 python1.5])
   dnl library.
 
   AC_CACHE_CHECK([for $am_display_PYTHON version], [am_cv_python_version],
-    [am_cv_python_version=`$PYTHON -c "import sys; print sys.version[[:3]]"`])
+    [am_cv_python_version=`$PYTHON -c "import sys; sys.stdout.write(sys.version[[:3]])"`])
   AC_SUBST([PYTHON_VERSION], [$am_cv_python_version])
 
   dnl Use the values of $prefix and $exec_prefix for the corresponding
@@ -102,7 +100,7 @@ python2.1 python2.0 python1.6 python1.5])
   dnl to know which OS platform Python thinks this is.
 
   AC_CACHE_CHECK([for $am_display_PYTHON platform], [am_cv_python_platform],
-    [am_cv_python_platform=`$PYTHON -c "import sys; print sys.platform"`])
+    [am_cv_python_platform=`$PYTHON -c "import sys; sys.stdout.write(sys.platform)"`])
   AC_SUBST([PYTHON_PLATFORM], [$am_cv_python_platform])
 
 
@@ -155,14 +153,15 @@ python2.1 python2.0 python1.6 python1.5])
 # Run ACTION-IF-FALSE otherwise.
 # This test uses sys.hexversion instead of the string equivalent (first
 # word of sys.version), in order to cope with versions such as 2.2c1.
-# hexversion has been introduced in Python 1.5.2; it's probably not
-# worth to support older versions (1.5.1 was released on October 31, 1998).
+# This supports Python 2.0 or higher. (2.0 was released on October 16, 2000).
 AC_DEFUN([AM_PYTHON_CHECK_VERSION],
- [prog="import sys, string
+ [prog="import sys
 # split strings by '.' and convert to numeric.  Append some zeros
 # because we need at least 4 digits for the hex conversion.
-minver = map(int, string.split('$2', '.')) + [[0, 0, 0]]
+# map returns an iterator in Python 3.0 and a list in 2.x
+minver = list(map(int, '$2'.split('.'))) + [[0, 0, 0]]
 minverhex = 0
-for i in xrange(0, 4): minverhex = (minverhex << 8) + minver[[i]]
+# xrange is not present in Python 3.0 and range returns an iterator
+for i in list(range(0, 4)): minverhex = (minverhex << 8) + minver[[i]]
 sys.exit(sys.hexversion < minverhex)"
   AS_IF([AM_RUN_LOG([$1 -c "$prog"])], [$3], [$4])])