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