From 04d5734d6992c6ab0bdd18b4361ba86a2281eefc Mon Sep 17 00:00:00 2001 From: Esko Kokkonen Date: Fri, 26 Aug 2011 12:30:53 +0300 Subject: [PATCH] Fix but with packages with names with '-'s in them So like packages name 'gcc-config' --- emerge-timer.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/emerge-timer.py b/emerge-timer.py index 998de5f..18e3a8a 100755 --- a/emerge-timer.py +++ b/emerge-timer.py @@ -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) -- 2.44.0