]> git.itanic.dy.fi Git - emerge-timer/commitdiff
Fix but with packages with names with '-'s in them
authorEsko Kokkonen <esko.kokkonen@gmail.com>
Fri, 26 Aug 2011 09:30:53 +0000 (12:30 +0300)
committerEsko Kokkonen <esko.kokkonen@gmail.com>
Fri, 26 Aug 2011 09:30:53 +0000 (12:30 +0300)
So like packages name 'gcc-config'

emerge-timer.py

index 998de5f65b35fe30e8704a4dedc97e93babf4386..18e3a8a1b78c132a964d186b7683a2bdac0110dc 100755 (executable)
@@ -109,18 +109,21 @@ def search_log_for_package(user_package):
         if ((">>>" in line) and ("emerge" in line)):
             if user_package in line:
                 version = line.partition(user_package)[2].partition(' ')[0]
+                digit = version.strip('-')[0].isdigit()
 
-                time_string = line.partition(">>>")
-                start_time = float(time_string[0].strip().strip(':'))
+                if digit:
+                    time_string = line.partition(">>>")
+                    start_time = float(time_string[0].strip().strip(':'))
 
         elif ((":::" in line) and ("completed emerge" in line)):
             if user_package in line:
-                time_string = line.partition(":::")
-                stop_time = float(time_string[0].strip().strip(':'))
+                if digit:
+                    time_string = line.partition(":::")
+                    stop_time = float(time_string[0].strip().strip(':'))
 
-                emerge_time = stop_time - start_time
+                    emerge_time = stop_time - start_time
 
-                packages[0].add_version(version, emerge_time, start_time)
+                    packages[0].add_version(version, emerge_time, start_time)