Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/webapp-config:master commit in: WebappConfig/
Date: Fri, 29 Jun 2012 13:01:14
Message-Id: 1340974224.df1ee77098fbb7eda685ffbea88dca9fea18adfd.blueness@gentoo
1 commit: df1ee77098fbb7eda685ffbea88dca9fea18adfd
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Thu Jun 28 23:13:53 2012 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Fri Jun 29 12:50:24 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/webapp-config.git;a=commit;h=df1ee770
7
8 Use print() function for compatibility with Python 3.
9
10 Signed-off-by: Anthony G. Basile <blueness <AT> gentoo.org>
11
12 ---
13 WebappConfig/config.py | 4 +-
14 WebappConfig/db.py | 2 +-
15 WebappConfig/debug.py | 69 ++++++++++++++++++++++++-----------------------
16 WebappConfig/server.py | 2 +-
17 WebappConfig/version.py | 2 +-
18 5 files changed, 40 insertions(+), 39 deletions(-)
19
20 diff --git a/WebappConfig/config.py b/WebappConfig/config.py
21 index 9ac303e..371602e 100644
22 --- a/WebappConfig/config.py
23 +++ b/WebappConfig/config.py
24 @@ -1055,9 +1055,9 @@ class Config:
25 for i in self.config.options('USER'):
26 if not i in ['pn', 'pvr']:
27 try:
28 - print i.upper() + '="' + self.config.get('USER', i) + '"'
29 + print(i.upper() + '="' + self.config.get('USER', i) + '"')
30 except InterpolationSyntaxError:
31 - print '# Failed to evaluate: ' + i.upper()
32 + print('# Failed to evaluate: ' + i.upper())
33
34 sys.exit(0)
35
36
37 diff --git a/WebappConfig/db.py b/WebappConfig/db.py
38 index aa78c24..fc221bf 100644
39 --- a/WebappConfig/db.py
40 +++ b/WebappConfig/db.py
41 @@ -456,7 +456,7 @@ class WebappDB(AppHierarchy):
42 OUT.info(' ' + i[3].strip(), 1)
43 else:
44 # This is a simplified form for the webapp.eclass
45 - print i[3].strip()
46 + print(i[3].strip())
47
48 # ========================================================================
49 # Handler for /usr/share/webapps
50
51 diff --git a/WebappConfig/debug.py b/WebappConfig/debug.py
52 index c3a5c47..7236e27 100644
53 --- a/WebappConfig/debug.py
54 +++ b/WebappConfig/debug.py
55 @@ -5,6 +5,7 @@
56 # Copyright 2005 Gunnar Wrobel
57 # Distributed under the terms of the GNU General Public License v2
58
59 +from __future__ import print_function
60 __version__ = "$Id: debug.py 159 2005-11-10 09:48:25Z wrobel $"
61
62 #################################################################################
63 @@ -294,7 +295,7 @@ class Message:
64 ## Output Functions
65
66 def notice (self, note):
67 - print note
68 + print(note)
69
70 def info (self, info, level = 4):
71
72 @@ -304,7 +305,7 @@ class Message:
73 return
74
75 for i in info.split('\n'):
76 - print self.maybe_color('green', '* ') + i
77 + print(self.maybe_color('green', '* ') + i)
78
79 def status (self, message, status, info = 'ignored'):
80
81 @@ -316,7 +317,7 @@ class Message:
82 return
83
84 for i in lines[0:-1]:
85 - print self.maybe_color('green', '* ') + i
86 + print(self.maybe_color('green', '* ') + i)
87
88 i = lines[-1]
89
90 @@ -330,8 +331,8 @@ class Message:
91 else:
92 result = '[' + self.maybe_color('yellow', info) + ']'
93
94 - print self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i)) \
95 - + ' ' + result
96 + print(self.maybe_color('green', '* ') + i + ' ' + '.' * (58 - len(i)) \
97 + + ' ' + result)
98
99 def warn (self, warn, level = 4):
100
101 @@ -341,14 +342,14 @@ class Message:
102 return
103
104 for i in warn.split('\n'):
105 - print self.maybe_color('yellow', '* ') + i
106 + print(self.maybe_color('yellow', '* ') + i)
107
108 def error (self, error):
109
110 error = str(error)
111
112 for i in error.split('\n'):
113 - print >> self.error_out, self.maybe_color('red', '* ') + i
114 + print(self.maybe_color('red', '* ') + i, file=self.error_out)
115 self.has_error = True
116
117 def die (self, error):
118 @@ -429,11 +430,11 @@ class Message:
119 if lines > 0:
120 for j in range(lines):
121 ## Print line with continuation marker
122 - print >> self.debug_out, ls + '// ' + x[0:60] + ' \\'
123 + print(ls + '// ' + x[0:60] + ' \\', file=self.debug_out)
124 ## Remove printed characters from output
125 x = x[60:]
126 ## Print final line
127 - print >> self.debug_out, ls + '// ' + x
128 + print(ls + '// ' + x, file=self.debug_out)
129
130 if self.debug_vrb == 1:
131 # Top line indicates class and method
132 @@ -442,60 +443,60 @@ class Message:
133 c += 'Class: ' + str(callerobject.__class__.__name__) + ' | '
134 if callermethod:
135 c += 'Method: ' + str(callermethod)
136 - print >> self.debug_out, '// ' + c
137 + print('// ' + c, file=self.debug_out)
138 # Selected variables follow
139 if callerlocals:
140 for i,j in callerlocals.items():
141 - print >> self.debug_out, '// ' \
142 - + self.maybe_color('turquoise', str(i)) + ':' + str(j)
143 + print('// ' \
144 + + self.maybe_color('turquoise', str(i)) + ':' + str(j), file=self.debug_out)
145 # Finally the message
146 - print >> self.debug_out, self.maybe_color('yellow', message)
147 + print(self.maybe_color('yellow', message), file=self.debug_out)
148 return
149
150 if self.debug_vrb == 3:
151 - print >> self.debug_out, ls + '/////////////////////////////////' + \
152 - '////////////////////////////////'
153 + print(ls + '/////////////////////////////////' + \
154 + '////////////////////////////////', file=self.debug_out)
155
156 # General information about what is being debugged
157 #(module name or similar)
158 - print >> self.debug_out, ls + '// ' + self.debug_env
159 - print >> self.debug_out, ls + '//-----------------------------------' + \
160 - '----------------------------'
161 + print(ls + '// ' + self.debug_env, file=self.debug_out)
162 + print(ls + '//-----------------------------------' + \
163 + '----------------------------', file=self.debug_out)
164
165 ## If the caller is a class print the name here
166 if callerobject:
167 - print >> self.debug_out, ls + \
168 - '// Object Class: ' + str(callerobject.__class__.__name__)
169 + print(ls + \
170 + '// Object Class: ' + str(callerobject.__class__.__name__), file=self.debug_out)
171
172 ## If the method has been extracted print it here
173 if callermethod:
174 - print >> self.debug_out, ls + '// ' \
175 - + self.maybe_color('green', 'Method: ') + str(callermethod)
176 + print(ls + '// ' \
177 + + self.maybe_color('green', 'Method: ') + str(callermethod), file=self.debug_out)
178 if self.debug_vrb == 3:
179 - print >> self.debug_out, ls + '//---------------------------' + \
180 - '------------------------------------'
181 + print(ls + '//---------------------------' + \
182 + '------------------------------------', file=self.debug_out)
183
184 ## Print the information on all available local variables
185 if callerlocals:
186 if self.debug_vrb == 3:
187 - print >> self.debug_out, ls + '//'
188 - print >> self.debug_out, ls + '// VALUES '
189 + print(ls + '//', file=self.debug_out)
190 + print(ls + '// VALUES ', file=self.debug_out)
191 for i,j in callerlocals.items():
192 - print >> self.debug_out, ls + '// ------------------> ' \
193 - + self.maybe_color('turquoise', str(i)) + ':'
194 + print(ls + '// ------------------> ' \
195 + + self.maybe_color('turquoise', str(i)) + ':', file=self.debug_out)
196 breaklines(str(j))
197 if self.debug_vrb == 3:
198 - print >> self.debug_out, ls + '//------------------------------'\
199 - '---------------------------------'
200 + print(ls + '//------------------------------'\
201 + '---------------------------------', file=self.debug_out)
202
203 # Finally print the message
204 breaklines(self.maybe_color('yellow', message))
205
206 if self.debug_vrb == 3:
207 - print >> self.debug_out, ls + '//-------------------------------' + \
208 - '--------------------------------'
209 - print >> self.debug_out, ls + '/////////////////////////////////' + \
210 - '////////////////////////////////'
211 + print(ls + '//-------------------------------' + \
212 + '--------------------------------', file=self.debug_out)
213 + print(ls + '/////////////////////////////////' + \
214 + '////////////////////////////////', file=self.debug_out)
215
216 ## gloabal message handler
217 OUT = Message('webapp-config')
218
219 diff --git a/WebappConfig/server.py b/WebappConfig/server.py
220 index 2272d76..f67ecdb 100644
221 --- a/WebappConfig/server.py
222 +++ b/WebappConfig/server.py
223 @@ -49,7 +49,7 @@ class Basic:
224 pm):
225
226 if self.dep and not self.supported(pm):
227 - print self.dep
228 + print(self.dep)
229 OUT.die('Your configuration file sets the server type "' + self.name
230 + '"\nbut the corresponding package does not seem to be '
231 'installed!\nPlease "emerge ' + self.dep + '" or correct '
232
233 diff --git a/WebappConfig/version.py b/WebappConfig/version.py
234 index c09a903..ddf6c9d 100644
235 --- a/WebappConfig/version.py
236 +++ b/WebappConfig/version.py
237 @@ -16,4 +16,4 @@
238 WCVERSION = '1.50.18'
239
240 if __name__ == '__main__':
241 - print WCVERSION
242 + print(WCVERSION)