summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@debian.org>2018-11-09 14:04:31 -0500
committerAntoine Beaupré <anarcat@debian.org>2018-11-09 14:04:31 -0500
commit1ac9ca9173bf9568f90128f870df7d0ffcec7d7c (patch)
treebe045ad17a45ad10a8ba1ad33b95b569b80fafb1 /bin
parent0543551f714b166e7a8c2691c8c0a361fd910124 (diff)
allow for human-friendly date ranges as well
Diffstat (limited to 'bin')
-rwxr-xr-xbin/review-update-needed18
1 files changed, 15 insertions, 3 deletions
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'

© 2014-2024 Faster IT GmbH | imprint | privacy policy