[systemd-commits] src/analyze

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jun 19 10:47:56 PDT 2012


 src/analyze/systemd-analyze |   16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

New commits:
commit e23637b64920309466481203285c8bf0d902eee3
Author: Shawn Landden <shawnlandden at gmail.com>
Date:   Thu Jun 14 15:08:19 2012 -0700

    analyze: Python 3 compatibility
    
    Plot verb doesn't currently work b/c Cairo bug sending to stdout in python 3.

diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze
index 5d451c3..76eceee 100755
--- a/src/analyze/systemd-analyze
+++ b/src/analyze/systemd-analyze
@@ -91,16 +91,16 @@ def time():
         initrd_time, start_time, finish_time = acquire_start_time()
 
         if initrd_time > 0:
-                print "Startup finished in %lums (kernel) + %lums (initramfs) + %lums (userspace) = %lums" % ( \
+                sys.stdout.write("Startup finished in %lums (kernel) + %lums (initramfs) + %lums (userspace) = %lums\n" % ( \
                         initrd_time/1000, \
                         (start_time - initrd_time)/1000, \
                         (finish_time - start_time)/1000, \
-                        finish_time/1000)
+                        finish_time/1000))
         else:
-                print "Startup finished in %lums (kernel) + %lums (userspace) = %lums" % ( \
+                sys.stdout.write("Startup finished in %lums (kernel) + %lums (userspace) = %lums\n" % ( \
                         start_time/1000, \
                         (finish_time - start_time)/1000, \
-                        finish_time/1000)
+                        finish_time/1000))
 
 
 def blame():
@@ -161,7 +161,7 @@ def plot():
         context.set_line_width(1)
         context.set_source_rgb(0.7, 0.7, 0.7)
 
-        for x in range(0, finish_time/10000 + 100, 100):
+        for x in range(0, int(finish_time/10000) + 100, 100):
                 context.move_to(x, 0)
                 context.line_to(x, height-border*2)
 
@@ -185,7 +185,7 @@ def plot():
         banner = "{} {} ({} {}) {}".format(osrel, *(os.uname()[1:5]))
         draw_text(context, 0, -15, banner, hcenter = 0, vcenter = 1)
 
-        for x in range(0, finish_time/10000 + 100, 100):
+        for x in range(0, int(finish_time/10000) + 100, 100):
                 draw_text(context, x, -5, "%lus" % (x/100), vcenter = 0, hcenter = 0)
 
         y = 0
@@ -285,8 +285,8 @@ bus = dbus.SystemBus()
 
 try:
         opts, args = getopt.gnu_getopt(sys.argv[1:], "h", ["help", "user"])
-except getopt.GetoptError, err:
-        print str(err)
+except getopt.GetoptError as err:
+        sys.stdout.write(str(err) + "\n")
         usage()
         sys.exit(2)
 for o, a in opts:



More information about the systemd-commits mailing list