1919# along with Patchwork; if not, write to the Free Software
2020# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
2121
22+ from __future__ import print_function
23+
2224import os
2325import sys
2426import xmlrpclib
@@ -170,9 +172,9 @@ def action_list(rpc, filter, submitter_str, delegate_str, format_str=None):
170172 else :
171173 for id in ids :
172174 person = rpc .person_get (id )
173- print " Patches submitted by %s <%s>:" % \
174- (unicode (person ['name' ]).encode (" utf-8" ), \
175- unicode (person ['email' ]).encode (" utf-8" ))
175+ print ( ' Patches submitted by %s <%s>:' %
176+ (unicode (person ['name' ]).encode (' utf-8' ),
177+ unicode (person ['email' ]).encode (' utf-8' ) ))
176178 f = filter
177179 f .add ("submitter_id" , id )
178180 patches = rpc .patch_list (f .d )
@@ -187,8 +189,8 @@ def action_list(rpc, filter, submitter_str, delegate_str, format_str=None):
187189 else :
188190 for id in ids :
189191 person = rpc .person_get (id )
190- print " Patches delegated to %s <%s>:" % \
191- (person ['name' ], person ['email' ])
192+ print ( ' Patches delegated to %s <%s>:' %
193+ (person ['name' ], person ['email' ]) )
192194 f = filter
193195 f .add ("delegate_id" , id )
194196 patches = rpc .patch_list (f .d )
@@ -245,7 +247,7 @@ def action_get(rpc, patch_id):
245247 try :
246248 f .write (unicode (s ).encode ("utf-8" ))
247249 f .close ()
248- print " Saved patch to %s" % fname
250+ print ( ' Saved patch to %s' % fname )
249251 except :
250252 sys .stderr .write ("Failed to write to %s\n " % fname )
251253 sys .exit (1 )
@@ -258,13 +260,13 @@ def action_apply(rpc, patch_id, apply_cmd=None):
258260 sys .exit (1 )
259261
260262 if apply_cmd is None :
261- print " Applying patch #%d to current directory" % patch_id
263+ print ( ' Applying patch #%d to current directory' % patch_id )
262264 apply_cmd = ['patch' , '-p1' ]
263265 else :
264- print " Applying patch #%d using %s" % (
265- patch_id , repr (' ' .join (apply_cmd )))
266+ print ( ' Applying patch #%d using %s' %
267+ ( patch_id , repr (' ' .join (apply_cmd ) )))
266268
267- print " Description: %s" % patch ['name' ]
269+ print ( ' Description: %s' % patch ['name' ])
268270 s = rpc .patch_get_mbox (patch_id )
269271 if len (s ) > 0 :
270272 proc = subprocess .Popen (apply_cmd , stdin = subprocess .PIPE )
@@ -299,7 +301,7 @@ def action_update_patch(rpc, patch_id, state = None, archived = None, commit = N
299301 success = False
300302 try :
301303 success = rpc .patch_set (patch_id , params )
302- except xmlrpclib .Fault , f :
304+ except xmlrpclib .Fault as f :
303305 sys .stderr .write ("Error updating patch: %s\n " % f .faultString )
304306
305307 if not success :
@@ -702,7 +704,7 @@ def main():
702704 for patch_id in non_empty (h , patch_ids ):
703705 s = rpc .patch_get_mbox (patch_id )
704706 if len (s ) > 0 :
705- print unicode (s ).encode ("utf-8" )
707+ print ( unicode (s ).encode ("utf-8" ) )
706708
707709 elif action == 'info' :
708710 for patch_id in non_empty (h , patch_ids ):
0 commit comments