diff --git a/scripts/update_license_headers.py b/scripts/update_license_headers.py index ee9f1ef9a44ca746a65cde687b5bee0e380f8284..eda54099ac06f4aed0c26bd70720b0ba99cffefe 100644 --- a/scripts/update_license_headers.py +++ b/scripts/update_license_headers.py @@ -27,6 +27,7 @@ FILE_PATH_SKIPPED = 'out-skipped.txt' FILE_PATH_NO_HEADER = 'out-no-header.txt' FILE_PATH_UPDATED = 'out-updated.txt' +STR_NEW_COPYRIGHT = 'Copyright 2022-2024 ETSI TeraFlowSDN - TFS OSG/SDG (https://tfs.etsi.org/)' RE_OLD_COPYRIGHTS = [ r'Copyright\ 2021\-2023\ H2020\ TeraFlow\ \(https\:\/\/www\.teraflow\-h2020\.eu\/\)', r'Copyright\ 2022\-2023\ ETSI\ TeraFlowSDN\ \-\ TFS\ OSG\ \(https\:\/\/tfs\.etsi\.org\/\)', @@ -36,8 +37,6 @@ RE_OLD_COPYRIGHTS = [ for re_old_copyright in RE_OLD_COPYRIGHTS ] -STR_NEW_COPYRIGHT = 'Copyright 2022-2024 ETSI TeraFlowSDN - TFS OSG/SDG (https://tfs.etsi.org/)' - def skip_file(file_path : str) -> bool: if os.path.islink(file_path): return True if file_path.endswith('.pyc'): return True @@ -80,16 +79,10 @@ def skip_file(file_path : str) -> bool: return False def process_line(line_in : str) -> str: - print('line_in', line_in) for re_match, re_sub in RE_OLD_COPYRIGHTS: - print('re_match', re_match) - print('re_sub', re_sub) match = re_match.match(line_in) - print('match', match) if match is None: continue - print('matched!') line_out = re_sub.sub(STR_NEW_COPYRIGHT, line_in) - print('line_out', line_out) return line_out return line_in @@ -123,8 +116,6 @@ def process_file( os.rename(temp_file_path, file_path) os.chmod(file_path, file_stat.st_mode) - raise Exception() - def main() -> int: with open(FILE_PATH_NO_HEADER, 'w', encoding='UTF-8') as file_no_header: with open(FILE_PATH_SKIPPED, 'w', encoding='UTF-8') as file_skipped: