[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Improve python support
From: |
Yaakov (Cygwin/X) |
Subject: |
[PATCH] Improve python support |
Date: |
Mon, 5 Nov 2012 11:45:15 -0600 |
From: Yaakov Selkowitz <address@hidden>
* m4/python.m4 (AM_PATH_PYTHON): Add python3.3 to _AM_PYTHON_INTERPRETER_LIST.
* lib/py-compile: Fix compiled filenames for PEP-3147, currently implemented
in CPython 3.2 and newer. Do not create .pyo files for PyPy.
Signed-off-by: Yaakov Selkowitz <address@hidden>
---
lib/py-compile | 18 ++++++++++++++----
m4/python.m4 | 2 +-
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/lib/py-compile b/lib/py-compile
index 6916903..14d0d12 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -116,7 +116,7 @@ else
fi
$PYTHON -c "
-import sys, os, py_compile
+import sys, os, py_compile, imp
files = '''$files'''
@@ -129,12 +129,19 @@ for file in files.split():
continue
sys.stdout.write(file)
sys.stdout.flush()
- py_compile.compile(filepath, filepath + 'c', path)
+ if hasattr(imp, 'get_tag'):
+ py_compile.compile(filepath, imp.cache_from_source(filepath), path)
+ else:
+ py_compile.compile(filepath, filepath + 'c', path)
sys.stdout.write('\n')" || exit $?
# this will fail for python < 1.5, but that doesn't matter ...
$PYTHON -O -c "
-import sys, os, py_compile
+import sys, os, py_compile, imp
+
+# pypy does not use .pyo optimization
+if hasattr(sys, 'pypy_translation_info'):
+ sys.exit(0)
files = '''$files'''
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
@@ -146,7 +153,10 @@ for file in files.split():
continue
sys.stdout.write(file)
sys.stdout.flush()
- py_compile.compile(filepath, filepath + 'o', path)
+ if hasattr(imp, 'get_tag'):
+ py_compile.compile(filepath, imp.cache_from_source(filepath, False),
path)
+ else:
+ py_compile.compile(filepath, filepath + 'o', path)
sys.stdout.write('\n')" 2>/dev/null || :
# Local Variables:
diff --git a/m4/python.m4 b/m4/python.m4
index a247818..50213a9 100644
--- a/m4/python.m4
+++ b/m4/python.m4
@@ -37,7 +37,7 @@ AC_DEFUN([AM_PATH_PYTHON],
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 python3 python3.2 python3.1 python3.0 python2.7 dnl
+[python python2 python3 python3.3 python3.2 python3.1 python3.0 python2.7 dnl
python2.6 python2.5 python2.4 python2.3 python2.2 python2.1 python2.0])
AC_ARG_VAR([PYTHON], [the Python interpreter])
--
1.7.9
- [PATCH] Improve python support,
Yaakov (Cygwin/X) <=
- Re: [PATCH] Improve python support, Stefano Lattarini, 2012/11/19
- [PATCH 0/8] tests: support for PEP-3147, and testsuite fixes, Stefano Lattarini, 2012/11/19
- [PATCH 1/8] python: improve support for modern python (CPython 3.2 and PyPy), Stefano Lattarini, 2012/11/19
- [PATCH 2/8] news: document fix for bug#8847 (PEP-3147, __pycache__), Stefano Lattarini, 2012/11/19
- [PATCH 3/8] tests: typofix in message, Stefano Lattarini, 2012/11/19
- [PATCH 4/8] tests: honour $PYTHON override, Stefano Lattarini, 2012/11/19
- [PATCH 5/8] tests: improve a comment, Stefano Lattarini, 2012/11/19
- [PATCH 6/8] python: uninstall cater to PEP-3147, Stefano Lattarini, 2012/11/19
- [PATCH 8/8] tests: fix a spurious failure when $PYTHON is in the environment, Stefano Lattarini, 2012/11/19
- [PATCH 7/8] python tests: support PEP-3147 installation layout, Stefano Lattarini, 2012/11/19