2 # called as "py-compile [--basedir DIR] PY_FILES ...
4 if [ -z "$PYTHON" ]; then
16 echo "Usage: py-compile [--basedir DIR] PY_FILES ..."
17 echo "Byte compile some python scripts. This should be performed"
18 echo "after they have been moved to the final installation location"
22 echo "py-compile version 0.0"
28 echo "No files given to $0" 1>&2
32 # if basedir was given, then it should be prepended to filenames before
34 if [ -z "$basedir" ]; then
37 trans
="path = os.path.join('$basedir', file)"
41 import sys, os, string, py_compile
44 print 'Byte-compiling python modules...'
45 for file in string.split(files):
47 if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
51 py_compile.compile(path)
54 # this will fail for python < 1.5, but that doesn't matter ...
56 import sys, os, string, py_compile
59 print 'Byte-compiling python modules (optimised versions) ...'
60 for file in string.split(files):
62 if not os.path.exists(path) or not (len(path) >= 3 and path[-3:] == '.py'):
66 py_compile.compile(path)
67 print" 2>/dev
/null ||
: