jhbuild r2553 - in trunk: . jhbuild/commands



Author: fpeters
Date: Sun Nov 30 19:54:29 2008
New Revision: 2553
URL: http://svn.gnome.org/viewvc/jhbuild?rev=2553&view=rev

Log:
* jhbuild/commands/base.py: proper error message on unparseable
relative time; and allow week numbers as relative time.



Modified:
   trunk/ChangeLog
   trunk/jhbuild/commands/base.py

Modified: trunk/jhbuild/commands/base.py
==============================================================================
--- trunk/jhbuild/commands/base.py	(original)
+++ trunk/jhbuild/commands/base.py	Sun Nov 30 19:54:29 2008
@@ -31,9 +31,9 @@
 
 
 def parse_relative_time(s):
-    m = re.match(r'(\d+) *([smhd])', s.lower())
+    m = re.match(r'(\d+) *([smhdw])', s.lower())
     if m:
-        coeffs = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400}
+        coeffs = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400, 'w':7*86400}
         return float(m.group(1)) * coeffs[m.group(2)]
     else:
         raise ValueError(_('unable to parse \'%s\' as relative time.') % s)
@@ -253,7 +253,10 @@
         if options.force_policy:
             config.build_policy = 'all'
         if options.min_age:
-            config.min_time = time.time() - parse_relative_time(options.min_age)
+            try:
+                config.min_time = time.time() - parse_relative_time(options.min_age)
+            except ValueError:
+                raise FatalError(_('Failed to parse relative time'))
 
         if not config.quiet_mode:
             check_bootstrap_updateness(config)
@@ -336,7 +339,10 @@
         if options.force_policy:
             config.build_policy = 'all'
         if options.min_age:
-            config.min_time = time.time() - parse_relative_time(options.min_age)
+            try:
+                config.min_time = time.time() - parse_relative_time(options.min_age)
+            except ValueError:
+                raise FatalError(_('Failed to parse relative time'))
 
         if not config.quiet_mode:
             check_bootstrap_updateness(config)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]