diff --git a/contrib/devtools/copyright_header.py b/contrib/devtools/copyright_header.py --- a/contrib/devtools/copyright_header.py +++ b/contrib/devtools/copyright_header.py @@ -46,8 +46,8 @@ def applies_to_file(filename): - return ((EXCLUDE_COMPILED.match(filename) is None) and - (INCLUDE_COMPILED.match(filename) is not None)) + return ((EXCLUDE_COMPILED.match(filename) is None) + and (INCLUDE_COMPILED.match(filename) is not None)) ################################################################################ # obtain list of files in repo according to INCLUDE and EXCLUDE @@ -412,9 +412,9 @@ start_year, end_year = parse_year_range(year_range) if end_year == last_git_change_year: return line - return (before_copyright + copyright_splitter + - year_range_to_str(start_year, last_git_change_year) + ' ' + - ' '.join(space_split[1:])) + return (before_copyright + copyright_splitter + + year_range_to_str(start_year, last_git_change_year) + ' ' + + ' '.join(space_split[1:])) def update_updatable_copyright(filename): @@ -423,8 +423,9 @@ if not line: print_file_action_message(filename, "No updatable copyright.") return - last_git_change_year = get_most_recent_git_change_year(filename) - new_line = create_updated_copyright_line(line, last_git_change_year) + now = datetime.datetime.now() + current_year = now.year + new_line = create_updated_copyright_line(line, current_year) if line == new_line: print_file_action_message(filename, "Copyright up-to-date.") return @@ -432,7 +433,7 @@ write_file_lines(filename, file_lines) print_file_action_message(filename, "Copyright updated! -> {}".format( - last_git_change_year)) + current_year)) def exec_update_header_year(base_directory):