This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
automake: python3.2 and py-compile
- From: "Yaakov (Cygwin/X)" <yselkowitz at users dot sourceforge dot net>
- To: cygwin-apps at cygwin dot com
- Date: Tue, 26 Jun 2012 03:25:07 -0500
- Subject: automake: python3.2 and py-compile
Chuck,
Starting with 3.2, python implements PEP3147[1]. The attached patch
(for automake-1.11.3) fixes py-compile wrt this.
Yaakov
[1] http://www.python.org/dev/peps/pep-3147/
--- origsrc/pygobject-3.2.2/py-compile 2012-05-14 11:54:54.000000000 -0500
+++ src/pygobject-3.2.2/py-compile 2012-06-26 03:15:44.825568500 -0500
@@ -117,7 +117,7 @@ else
fi
$PYTHON -c "
-import sys, os, py_compile
+import imp, sys, os, py_compile
files = '''$files'''
@@ -130,12 +130,16 @@ for file in files.split():
continue
sys.stdout.write(file)
sys.stdout.flush()
- py_compile.compile(filepath, filepath + 'c', path)
+
+ if sys.version_info >= (3, 2, 0):
+ 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 imp, sys, os, py_compile
files = '''$files'''
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
@@ -147,7 +151,10 @@ for file in files.split():
continue
sys.stdout.write(file)
sys.stdout.flush()
- py_compile.compile(filepath, filepath + 'o', path)
+ if sys.version_info >= (3, 2, 0):
+ 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: