[Piuparts-devel] [Git][debian/piuparts][develop] 2 commits: Add '()' to print. Py2 and Py3 compatible

Holger Levsen gitlab at salsa.debian.org
Sun Jan 27 18:55:23 GMT 2019


Holger Levsen pushed to branch develop at Debian / piuparts


Commits:
e2d20077 by hpfn at 2019-01-27T18:53:42Z
Add '()' to print. Py2 and Py3 compatible

- - - - -
87d339fb by Holger Levsen at 2019-01-27T18:55:09Z
drop comment, we want to switch to python 3 anyway

Signed-off-by: Holger Levsen <holger at layer-acht.org>

- - - - -


5 changed files:

- debian/changelog
- piuparts-analyze.py
- piuparts-slave.py
- piuparts.py
- piupartslib/pkgsummary.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,6 +1,8 @@
 piuparts (0.97) UNRELEASED; urgency=medium
 
-  * ... 
+  [ Herbert Fortes ]
+  * piuparts.py, piuparts-slave.py, piupartslib/pkgsummary.py and
+    piuparts-analyze.py: add '()' to print. Py2 and Py3 compatible.
 
  -- Holger Levsen <holger at debian.org>  Sun, 13 Jan 2019 16:58:44 +0100
 


=====================================
piuparts-analyze.py
=====================================
@@ -29,7 +29,7 @@ headers of the log in ./fail to the one in ./bugged and vice versa. It will then
 move the failed log to ./bugged as well.
 
 """
-
+from __future__ import print_function
 
 import os
 import sys
@@ -311,7 +311,7 @@ def mark_logs_with_reported_bugs():
             raise
         except:
             print('ERROR processing %s' % failed_log)
-            print sys.exc_info()[0]
+            print(sys.exc_info()[0])
         alarm(0)
 
 


=====================================
piuparts-slave.py
=====================================
@@ -22,7 +22,7 @@
 
 Lars Wirzenius <liw at iki.fi>
 """
-
+from __future__ import print_function
 
 import os
 import sys
@@ -115,15 +115,15 @@ def alarm_handler(signum, frame):
 def sigint_handler(signum, frame):
     global interrupted
     interrupted = True
-    print '\nSlave interrupted by the user, waiting for the current test to finish.'
-    print 'Press Ctrl-C again to abort now.'
+    print('\nSlave interrupted by the user, waiting for the current test to finish.')
+    print('Press Ctrl-C again to abort now.')
     signal(SIGINT, old_sigint_handler)
 
 
 def sighup_handler(signum, frame):
     global got_sighup
     got_sighup = True
-    print 'SIGHUP: Will flush finished logs.'
+    print('SIGHUP: Will flush finished logs.')
 
 
 class MasterIsBusy(Exception):
@@ -820,7 +820,7 @@ def run_test_with_timeout(cmd, maxwait, kill_all=True):
             stdout, stderr = ps.communicate()
             pids.extend([int(pid) for pid in stdout.split()])
         if p.poll() is None:
-            print 'Sending SIGINT...'
+            print('Sending SIGINT...')
             try:
                 os.killpg(os.getpgid(p.pid), SIGINT)
             except OSError:
@@ -831,7 +831,7 @@ def run_test_with_timeout(cmd, maxwait, kill_all=True):
                 if p.poll() is not None:
                     break
         if p.poll() is None:
-            print 'Sending SIGTERM...'
+            print('Sending SIGTERM...')
             p.terminate()
             # piuparts has 5 seconds to clean up after SIGTERM
             for i in range(10):
@@ -839,13 +839,13 @@ def run_test_with_timeout(cmd, maxwait, kill_all=True):
                 if p.poll() is not None:
                     break
         if p.poll() is None:
-            print 'Sending SIGKILL...'
+            print('Sending SIGKILL...')
             p.kill()
         for pid in pids:
             if pid > 0:
                 try:
                     os.kill(pid, SIGKILL)
-                    print "Killed %d" % pid
+                    print("Killed %d" % pid)
                 except OSError:
                     pass
 
@@ -864,11 +864,11 @@ def run_test_with_timeout(cmd, maxwait, kill_all=True):
         terminate_subprocess(p, kill_all)
         return -1, stdout
     except KeyboardInterrupt:
-        print '\nSlave interrupted by the user, cleaning up...'
+        print('\nSlave interrupted by the user, cleaning up...')
         try:
             terminate_subprocess(p, kill_all)
         except KeyboardInterrupt:
-            print '\nTerminating piuparts was interrupted... manual cleanup still neccessary.'
+            print('\nTerminating piuparts was interrupted... manual cleanup still neccessary.')
             raise
         raise
 
@@ -1002,8 +1002,8 @@ if __name__ == "__main__":
     try:
         main()
     except KeyboardInterrupt:
-        print ''
-        print 'Slave interrupted by the user, exiting...'
+        print('')
+        print('Slave interrupted by the user, exiting...')
         sys.exit(1)
 
 # vi:set et ts=4 sw=4 :


=====================================
piuparts.py
=====================================
@@ -30,7 +30,7 @@ more usage information.
 
 Lars Wirzenius <liw at iki.fi>
 """
-
+from __future__ import print_function
 
 VERSION = "__PIUPARTS_VERSION__"
 
@@ -3175,7 +3175,7 @@ def main():
 
     # check if user has root privileges
     if os.getuid():
-        print 'You need to be root to use piuparts.'
+        print('You need to be root to use piuparts.')
         sys.exit(1)
 
     logging.info("-" * 78)
@@ -3230,18 +3230,18 @@ if __name__ == "__main__":
     try:
         main()
     except KeyboardInterrupt:
-        print ''
-        print 'Piuparts interrupted by the user, exiting...'
+        print('')
+        print('Piuparts interrupted by the user, exiting...')
         panic(1)
         sys.exit(1)
     except SystemExit:
         raise
     except:
-        print ''
-        print 'Piuparts caught exception, exiting...'
-        print '-'*60
+        print('')
+        print('Piuparts caught exception, exiting...')
+        print('-'*60)
         traceback.print_exc(file=sys.stdout)
-        print '-'*60
+        print('-'*60)
         panic(1)
         raise
 


=====================================
piupartslib/pkgsummary.py
=====================================
@@ -78,7 +78,7 @@
 #
 # The global file also includes an 'overall' json-section, which contains
 # the 'worst' result across the other json-sections.
-
+from __future__ import print_function
 
 import json
 import datetime
@@ -240,4 +240,4 @@ if __name__ == '__main__':
     for pkg in summary['packages']:
         flag, blocked, url = summary['packages'][pkg][DEFSEC]
 
-        print pkg, flag, url, tooltip(summary, pkg)
+        print(pkg, flag, url, tooltip(summary, pkg))



View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/af438cc8f5bc9a9c340b2ded659ffbc2e06dfea4...87d339fb67a76987b715349cf210187e5d93aeea

-- 
View it on GitLab: https://salsa.debian.org/debian/piuparts/compare/af438cc8f5bc9a9c340b2ded659ffbc2e06dfea4...87d339fb67a76987b715349cf210187e5d93aeea
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/piuparts-devel/attachments/20190127/7be744af/attachment-0001.html>


More information about the Piuparts-devel mailing list