tests: Tweak copyright year test
It currently asserts that the current year is included in the
copyright header, which isn't really what we want.
This commit makes the test only assert there is a valid year
(1970 <= year <= current_year) in the header.
@@ -40,17 +40,23 @@ def copyright_is_valid(fname):
except IndexError:
return False
- # The copyright mentions ARM Limited
- if "ARM Limited" not in lines[0]:
+ # The copyright mentions ARM/Arm Limited
+ if not any([name in lines[0] for name in ["ARM Limited", "Arm Limited"]]):
return False
apache_line = 6
if "Google Inc" in lines[1]:
apache_line += 1
- # The Copyright includes the current year
+ # The Copyright includes valid years
current_year = date.today().year
- if str(current_year) not in lines[0]:
+ years = map(int, re.findall(r"[-\s](?P<year>\d+)", lines[0]))
+
+ if len(years) < 0:
+ return False
+
+ for year in years:
+ if year < 1970 or year > current_year:
return False
# It's the apache license
