Revision 1657353c autotools/check-news

b/autotools/check-news
1 1
#!/usr/bin/python
2 2
#
3 3

  
4
# Copyright (C) 2011, 2012 Google Inc.
4
# Copyright (C) 2011, 2012, 2013 Google Inc.
5 5
#
6 6
# This program is free software; you can redistribute it and/or modify
7 7
# it under the terms of the GNU General Public License as published by
......
40 40
UNRELEASED_RE = re.compile(r"^\*\(unreleased\)\*$")
41 41
VERSION_RE = re.compile(r"^Version \d+(\.\d+)+( (beta|rc)\d+)?$")
42 42

  
43
#: How many days release timestamps may be in the future
44
TIMESTAMP_FUTURE_DAYS_MAX = 3
45

  
43 46
errors = []
44 47

  
45 48

  
......
115 118
      # would return an inconsistent result if the weekday is incorrect.
116 119
      parsed_ts = time.mktime(time.strptime(m.group("date"), "%d %b %Y"))
117 120
      parsed = datetime.date.fromtimestamp(parsed_ts)
121
      today = datetime.date.today()
122

  
123
      if (parsed - datetime.timedelta(TIMESTAMP_FUTURE_DAYS_MAX)) > today:
124
        Error("Line %s: %s is more than %s days in the future (today is %s)" %
125
              (fileinput.filelineno(), parsed, TIMESTAMP_FUTURE_DAYS_MAX,
126
               today))
127

  
118 128
      weekday = parsed.strftime("%a")
119 129

  
120 130
      # Check weekday

Also available in: Unified diff