From 1ac9ca9173bf9568f90128f870df7d0ffcec7d7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20Beaupr=C3=A9?= Date: Fri, 9 Nov 2018 14:04:31 -0500 Subject: allow for human-friendly date ranges as well --- bin/review-update-needed | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/review-update-needed b/bin/review-update-needed index 13e6d4a4ba..0798ef9095 100755 --- a/bin/review-update-needed +++ b/bin/review-update-needed @@ -8,6 +8,11 @@ import re import subprocess import sys +try: + import humanfriendly +except ImportError: + humanfriendly = None + def format_date(timestamp): date_to_format = datetime.utcfromtimestamp(timestamp) delta = datetime.utcnow() - date_to_format @@ -32,13 +37,20 @@ parser.add_argument('--sort-by', default='last-update', help='Sort by last-update (default) or by claimed-date') parser.add_argument('--skip-unclaimed', action='store_true', help='Skip unclaimed packages in the review') -parser.add_argument('--unclaim', default=None, metavar='N', type=int, - help='Automatically unclaim entries older than N seconds (default: no automatic unclaim)') +if humanfriendly: + parser.add_argument('--unclaim', default=None, metavar='N', + help='Automatically unclaim entries older than specified delta (default: no automatic unclaim)') +else: + parser.add_argument('--unclaim', default=None, metavar='N', type=int, + help='Automatically unclaim entries older than N seconds (default: no automatic unclaim)') args = parser.parse_args() if args.verbose and args.quiet: args.error("--verbose and --quiet contradiction") -unclaim_delta = timedelta(seconds=args.unclaim) +if humanfriendly: + unclaim_delta = timedelta(seconds=humanfriendly.parse_timespan(args.unclaim)) +else: + unclaim_delta = timedelta(seconds=args.unclaim) if args.lts: dsa_dla_needed = 'data/dla-needed.txt' -- cgit v1.2.3