2
2
# py-compile - Compile a Python program
4
scriptversion=2005-05-14.22
4
scriptversion=2009-04-28.21; # UTC
6
# Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc.
6
# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
8
9
# This program is free software; you can redistribute it and/or modify
9
10
# it under the terms of the GNU General Public License as published by
16
17
# GNU General Public License for more details.
18
19
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
22
# As a special exception to the GNU General Public License, if you
24
23
# distribute this file as part of a program that contains a
106
import sys, os, string, py_compile
105
import sys, os, py_compile
108
107
files = '''$files'''
110
print 'Byte-compiling python modules...'
111
for file in string.split(files):
109
sys.stdout.write('Byte-compiling python modules...\n')
110
for file in files.split():
114
113
if not os.path.exists(filepath) or not (len(filepath) >= 3
115
114
and filepath[-3:] == '.py'):
116
sys.stdout.write(file)
118
117
sys.stdout.flush()
119
118
py_compile.compile(filepath, filepath + 'c', path)
119
sys.stdout.write('\n')" || exit $?
122
121
# this will fail for python < 1.5, but that doesn't matter ...
124
import sys, os, string, py_compile
123
import sys, os, py_compile
126
125
files = '''$files'''
127
print 'Byte-compiling python modules (optimized versions) ...'
128
for file in string.split(files):
126
sys.stdout.write('Byte-compiling python modules (optimized versions) ...\n')
127
for file in files.split():
131
130
if not os.path.exists(filepath) or not (len(filepath) >= 3
132
131
and filepath[-3:] == '.py'):
133
sys.stdout.write(file)
135
134
sys.stdout.flush()
136
135
py_compile.compile(filepath, filepath + 'o', path)
137
print" 2>/dev/null || :
136
sys.stdout.write('\n')" 2>/dev/null || :
139
138
# Local Variables:
140
139
# mode: shell-script
142
141
# eval: (add-hook 'write-file-hooks 'time-stamp)
143
142
# time-stamp-start: "scriptversion="
144
143
# time-stamp-format: "%:y-%02m-%02d.%02H"
145
# time-stamp-end: "$"
144
# time-stamp-time-zone: "UTC"
145
# time-stamp-end: "; # UTC"