From 8ee66f41a43644330b6dc25058f97e83187de808 Mon Sep 17 00:00:00 2001 From: Esko Kokkonen Date: Thu, 4 Sep 2014 17:52:56 +0300 Subject: [PATCH] Add python3 compatibility Only confilct in the scrip between python2 and python3 was the behaviour of the print command. In python3 you can no long "print foo", but you have to "print(foo"). --- emerge-timer.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/emerge-timer.py b/emerge-timer.py index 1530f72..758a51a 100755 --- a/emerge-timer.py +++ b/emerge-timer.py @@ -295,7 +295,7 @@ def open_log(): try: f = open(LOGFILE, 'r') except IOError as detail: - print detail + print(detail) sys.exit(1) return f @@ -458,7 +458,7 @@ def list_emerge_processes(): if len(PACKAGES) == 0: - print "No current emerge process found." + print("No current emerge process found.") return 1 @@ -486,9 +486,9 @@ def list_emerge_processes(): def search_syncs(): f = open_log() - print "These emerge syncs found" - print "\tDate Server" - print "\t------------------------------" + print("These emerge syncs found") + print("\tDate Server") + print("\t------------------------------") a = 0 for line in f: @@ -547,7 +547,7 @@ def _main(status, user_package=None): if list_emerge_processes(): return - print "Currently emerging:" + print("Currently emerging:") for p in PACKAGES: search_log_for_package(p) @@ -557,7 +557,7 @@ def _main(status, user_package=None): elif status == "pretended": list_pretended() - print "This is how long these packages would take to emerge" + print("This is how long these packages would take to emerge") total_pretended_time = 0 @@ -589,7 +589,7 @@ Options: \t\t\t (needs matlibplot installed for this to work)""" - print usage + print(usage) sys.exit(0) -- 2.44.0