1111# option) any later version. See http://www.gnu.org/copyleft/gpl.html for
1212# the full text of the license.
1313
14+ from __future__ import print_function
15+
1416import getpass
1517import locale
1618import logging
@@ -515,7 +517,7 @@ https://fedorahosted.org/mailman/listinfo/python-bugzilla
515517http://www.bugzilla.org/docs/tip/en/html/api/Bugzilla/WebService/Bug.html
516518https://bugzilla.redhat.com/docs/en/html/api/Bugzilla/WebService/Bug.html'''
517519
518- print manpage
520+ print ( manpage )
519521
520522
521523def _do_query (bz , opt , parser ):
@@ -653,11 +655,11 @@ def _do_info(bz, opt):
653655
654656 if opt .products :
655657 for name in sorted ([p ["name" ] for p in products ]):
656- print name
658+ print ( name )
657659
658660 if opt .components :
659661 for name in sorted (bz .getcomponents (opt .components )):
660- print name
662+ print ( name )
661663
662664 if opt .component_owners :
663665 # Looking up this info for rhbz 'Fedora' product is sloooow
@@ -672,16 +674,16 @@ def _do_info(bz, opt):
672674
673675 component_details = bz .getcomponentsdetails (opt .component_owners )
674676 for c in sorted (component_details ):
675- print to_encoding (u"%s: %s" %
676- (c , component_details [c ]['initialowner' ]))
677+ print ( to_encoding (u"%s: %s" %
678+ (c , component_details [c ]['initialowner' ])))
677679
678680 if opt .versions :
679681 for p in products :
680682 if p ['name' ] != opt .versions :
681683 continue
682684 if "versions" in p :
683685 for v in p ['versions' ]:
684- print to_encoding (v ["name" ])
686+ print ( to_encoding (v ["name" ]) )
685687 break
686688
687689
@@ -723,12 +725,12 @@ def _format_output(bz, opt, buglist):
723725 if opt .output == 'raw' :
724726 buglist = bz .getbugs ([b .bug_id for b in buglist ])
725727 for b in buglist :
726- print "Bugzilla %s: " % b .bug_id
728+ print ( "Bugzilla %s: " % b .bug_id )
727729 for a in dir (b ):
728730 if a .startswith ("__" ) and a .endswith ("__" ):
729731 continue
730- print to_encoding (u"ATTRIBUTE[%s]: %s" % (a , getattr (b , a )))
731- print "\n \n "
732+ print ( to_encoding (u"ATTRIBUTE[%s]: %s" % (a , getattr (b , a ) )))
733+ print ( "\n \n " )
732734 return
733735
734736 def bug_field (matchobj ):
@@ -779,7 +781,7 @@ def _format_output(bz, opt, buglist):
779781 return to_encoding (val )
780782
781783 for b in buglist :
782- print format_field_re .sub (bug_field , opt .outputformat )
784+ print ( format_field_re .sub (bug_field , opt .outputformat ) )
783785
784786
785787def _parse_triset (vallist , checkplus = True , checkminus = True , checkequal = True ,
@@ -969,7 +971,7 @@ def _do_get_attach(bz, opt, parser, args):
969971 while data :
970972 outfile .write (data )
971973 data = att .read (4096 )
972- print "Wrote %s" % outfile .name
974+ print ( "Wrote %s" % outfile .name )
973975
974976 return
975977
@@ -1008,7 +1010,7 @@ def _do_set_attach(bz, opt, parser, args):
10081010 # Upload attachments
10091011 for bugid in args :
10101012 attid = bz .attachfile (bugid , fileobj , desc , ** kwargs )
1011- print "Created attachment %i on bug %s" % (attid , bugid )
1013+ print ( "Created attachment %i on bug %s" % (attid , bugid ) )
10121014
10131015
10141016#################
@@ -1080,10 +1082,10 @@ def main(bzinstance=None):
10801082 sys .stdout .write ('Logging in... ' )
10811083 sys .stdout .flush ()
10821084 if bz .login (global_opt .user , global_opt .password ):
1083- print 'Authorization cookie received.'
1085+ print ( 'Authorization cookie received.' )
10841086 sys .exit (0 )
10851087 else :
1086- print 'failed.'
1088+ print ( 'failed.' )
10871089 sys .exit (1 )
10881090
10891091 # Set up authentication
@@ -1162,32 +1164,32 @@ if __name__ == '__main__':
11621164 main ()
11631165 except KeyboardInterrupt :
11641166 log .debug ("" , exc_info = True )
1165- print "\n Exited at user request."
1167+ print ( "\n Exited at user request." )
11661168 sys .exit (1 )
11671169 except socket .error , e :
11681170 log .debug ("" , exc_info = True )
1169- print "\n Connection lost/failed: %s" % str (e )
1171+ print ( "\n Connection lost/failed: %s" % str (e ) )
11701172 sys .exit (2 )
11711173 except (xmlrpclib .Fault , urllib2 .HTTPError ), e :
11721174 log .debug ("" , exc_info = True )
1173- print "\n Server error: %s" % str (e )
1175+ print ( "\n Server error: %s" % str (e ) )
11741176 sys .exit (3 )
11751177 except xmlrpclib .ProtocolError , e :
11761178 log .debug ("" , exc_info = True )
1177- print "\n Invalid server response: %d %s" % (e .errcode , e .errmsg )
1179+ print ( "\n Invalid server response: %d %s" % (e .errcode , e .errmsg ) )
11781180
11791181 # Give SSL recommendations
11801182 import pycurl
11811183 sslerrcodes = [getattr (pycurl , ename ) for ename in dir (pycurl ) if
11821184 ename .startswith ("E_SSL" )]
11831185 if e .errcode in sslerrcodes :
1184- print ("\n If you trust the remote server, you can work "
1185- "around this error with:\n "
1186+ print ("\n If you trust the remote server, you can work "
1187+ "around this error with:\n "
11861188 " bugzilla --nosslverify ..." )
11871189
11881190 # Detect redirect
11891191 redir = (e .headers and e .headers .getheader ("location" , 0 ) or None )
11901192 if redir :
1191- print ("\n Server was attempting a redirect. Try: "
1192- " bugzilla --bugzilla %s ..." % redir )
1193+ print ("\n Server was attempting a redirect. Try: "
1194+ " bugzilla --bugzilla %s ..." % redir )
11931195 sys .exit (4 )
0 commit comments