+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.
- 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
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
@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
@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
@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,
@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
#!/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
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
## 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.
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
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])
# 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])])