]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Add python3 compatibility
authorEsko Kokkonen <esko.kokkonen@gmail.com>
Thu, 4 Sep 2014 14:52:56 +0000 (17:52 +0300)
committerEsko Kokkonen <esko.kokkonen@gmail.com>
Thu, 4 Sep 2014 14:52:56 +0000 (17:52 +0300)
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

index 1530f72f908663d1c6191055d940c0a2be10b5b0..758a51a2f4af1d0245c0768d6fe50e74bf1871f9 100755 (executable)
@@ -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)