summaryrefslogtreecommitdiff
path: root/py-compile
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:49:38 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-07-12 08:49:42 +0900
commitcf76ccccc8e2364c85afba6ea59645fc188c3d19 (patch)
tree2c81012b2bb78a08538c37d8797fc3eb13290d2d /py-compile
parent51369246466a689b3cc9798d22a73fb7fa86871f (diff)
downloadpygobject2-cf76ccccc8e2364c85afba6ea59645fc188c3d19.tar.gz
pygobject2-cf76ccccc8e2364c85afba6ea59645fc188c3d19.tar.bz2
pygobject2-cf76ccccc8e2364c85afba6ea59645fc188c3d19.zip
Imported Upstream version 3.8.3
Change-Id: I13575eb5c93076f72904221d0a092bc5929ee00b Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'py-compile')
-rwxr-xr-xpy-compile23
1 files changed, 16 insertions, 7 deletions
diff --git a/py-compile b/py-compile
index 15c834c..46ea866 100755
--- a/py-compile
+++ b/py-compile
@@ -3,8 +3,7 @@
scriptversion=2011-06-08.12; # UTC
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009, 2011 Free
-# Software Foundation, Inc.
+# Copyright (C) 2000-2013 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
@@ -37,7 +36,7 @@ me=py-compile
usage_error ()
{
echo "$me: $*" >&2
- echo "Try \`$me --help' for more information." >&2
+ echo "Try '$me --help' for more information." >&2
exit 1
}
@@ -117,7 +116,7 @@ else
fi
$PYTHON -c "
-import sys, os, py_compile
+import sys, os, py_compile, imp
files = '''$files'''
@@ -130,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')
@@ -147,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: