~ubuntu-branches/ubuntu/maverick/awn-extras-applets/maverick

« back to all changes in this revision

Viewing changes to py-compile

  • Committer: Bazaar Package Importer
  • Author(s): Julien Lavergne
  • Date: 2010-08-29 14:29:52 UTC
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20100829142952-rhvuetyms9bv5uu7
Tags: upstream-0.4.0+bzr1372
ImportĀ upstreamĀ versionĀ 0.4.0+bzr1372

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
# py-compile - Compile a Python program
3
3
 
4
 
scriptversion=2005-05-14.22
 
4
scriptversion=2009-04-28.21; # UTC
5
5
 
6
 
# Copyright (C) 2000, 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
 
6
# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
 
7
# Foundation, Inc.
7
8
 
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.
17
18
 
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
21
 
# 02110-1301, USA.
 
20
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
21
 
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
103
102
fi
104
103
 
105
104
$PYTHON -c "
106
 
import sys, os, string, py_compile
 
105
import sys, os, py_compile
107
106
 
108
107
files = '''$files'''
109
108
 
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():
112
111
    $pathtrans
113
112
    $filetrans
114
113
    if not os.path.exists(filepath) or not (len(filepath) >= 3
115
114
                                            and filepath[-3:] == '.py'):
116
 
        continue
117
 
    print file,
 
115
            continue
 
116
    sys.stdout.write(file)
118
117
    sys.stdout.flush()
119
118
    py_compile.compile(filepath, filepath + 'c', path)
120
 
print" || exit $?
 
119
sys.stdout.write('\n')" || exit $?
121
120
 
122
121
# this will fail for python < 1.5, but that doesn't matter ...
123
122
$PYTHON -O -c "
124
 
import sys, os, string, py_compile
 
123
import sys, os, py_compile
125
124
 
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():
129
128
    $pathtrans
130
129
    $filetrans
131
130
    if not os.path.exists(filepath) or not (len(filepath) >= 3
132
131
                                            and filepath[-3:] == '.py'):
133
 
        continue
134
 
    print file,
 
132
            continue
 
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 || :
138
137
 
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"
146
146
# End: