diff options
author | Shawn Landden <shawnlandden@gmail.com> | 2012-06-14 15:08:19 -0700 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-06-19 19:47:43 +0200 |
commit | e23637b64920309466481203285c8bf0d902eee3 (patch) | |
tree | b539450c284ffc55b21314274f57837a0c2b15ea /src | |
parent | 2138e96918c7ed6fbf31f5df509f337a1973dfdd (diff) |
analyze: Python 3 compatibility
Plot verb doesn't currently work b/c Cairo bug sending to stdout in python 3.
Diffstat (limited to 'src')
-rwxr-xr-x | src/analyze/systemd-analyze | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/analyze/systemd-analyze b/src/analyze/systemd-analyze index 5d451c35e5..76eceee9f0 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: |