Skip to content
Snippets Groups Projects
Commit e5fe391e authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Scripts - update_license_headers.py:

- Updated skip filters
parent c29d73cd
No related branches found
No related tags found
2 merge requests!235Release TeraFlowSDN 3.0,!224Resolve "Update license headers for Release 3"
...@@ -43,9 +43,11 @@ def skip_file(file_path : str) -> bool: ...@@ -43,9 +43,11 @@ def skip_file(file_path : str) -> bool:
if file_path.endswith('.pyc'): return True if file_path.endswith('.pyc'): return True
if file_path.endswith('_pb2_grpc.py'): return True if file_path.endswith('_pb2_grpc.py'): return True
if file_path.endswith('_pb2.py'): return True if file_path.endswith('_pb2.py'): return True
if file_path.endswith('.class'): return True
if file_path.endswith('.md'): return True if file_path.endswith('.md'): return True
if file_path.endswith('.png'): return True if file_path.endswith('.png'): return True
if file_path.endswith('.json'): return True if file_path.endswith('.json'): return True
if file_path.endswith('.csv'): return True
if file_path.endswith('.zip'): return True if file_path.endswith('.zip'): return True
if file_path.endswith('.zip'): return True if file_path.endswith('.zip'): return True
if file_path.endswith('.jar'): return True if file_path.endswith('.jar'): return True
...@@ -57,22 +59,38 @@ def skip_file(file_path : str) -> bool: ...@@ -57,22 +59,38 @@ def skip_file(file_path : str) -> bool:
if file_path.endswith('/grpc/grpcurl/grpcurl'): return True if file_path.endswith('/grpc/grpcurl/grpcurl'): return True
if file_path.endswith('/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent'): return True if file_path.endswith('/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsagent'): return True
if file_path.endswith('/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsping'): return True if file_path.endswith('/probe/probe-tfs/target/x86_64-unknown-linux-musl/release/tfsping'): return True
if file_path.startswith('./libyang/'): return True
if file_path.startswith('./netconf_openconfig/'): return True if file_path.startswith('./netconf_openconfig/'): return True
if file_path.startswith('./tmp/'): return True if file_path.startswith('./tmp/'): return True
if '/manifests/cttc-ols/' in file_path: return True if '/manifests/cttc-ols/' in file_path: return True
if '/hackfest/netconf-oc/openconfig/' in file_path: return True if '/hackfest/netconf-oc/openconfig/' in file_path: return True
if '/hackfest/tapi/server/tapi_server/' in file_path: return True
if '/hackfest/kafka/kafka_2.13-2.8.0/' in file_path: return True
if '/.git/' in file_path: return True if '/.git/' in file_path: return True
if '/.vscode/' in file_path: return True if '/.vscode/' in file_path: return True
if '/.pytest_cache/' in file_path: return True if '/.pytest_cache/' in file_path: return True
if '/__pycache__/' in file_path: return True if '/__pycache__/' in file_path: return True
if '/.mvn/' in file_path: return True if '/.mvn/' in file_path: return True
if '/hackfest/kafka/kafka_2.13-2.8.0' in file_path: return True if '/bgpls_speaker/service/java/netphony-topology/.settings/' in file_path: return True
if '/src/device/service/drivers/openconfig/templates/' in file_path: return True if '/bgpls_speaker/service/java/netphony-topology/' in file_path:
if '/ztp/target/generated-sources/grpc/' in file_path: return True file_path_parts = file_path.split('/')
if '/ztp/target/kubernetes/' in file_path: return True file_name = file_path_parts[-1]
if '/policy/target/generated-sources/grpc/' in file_path: return True return file_name in {'LICENSE', 'VERSION'}
if '/policy/target/kubernetes/' in file_path: return True if '/device/service/drivers/gnmi_openconfig/git/' in file_path: return True
if '/src/dlt/gateway/' in file_path: return True if '/device/service/drivers/openconfig/templates/' in file_path:
if file_path.endswith('.xml'): return True
file_path_parts = file_path.split('/')
file_name = file_path_parts[-1]
if file_name.startswith('openconfig_') and file_name.endswith('.py'): return True
return False
if '/nbi/service/rest_server/nbi_plugins/ietf_network/bindings/' in file_path: return True
if '/nbi/service/rest_server/nbi_plugins/ietf_network_slice/bindings/' in file_path: return True
if '/nbi/service/rest_server/nbi_plugins/ietf_l3vpn/yang/' in file_path: return True
if '/nbi/service/rest_server/nbi_plugins/ietf_network/yang/' in file_path: return True
if '/ztp/target/' in file_path: return True
if '/policy/target/' in file_path: return True
if '/dlt/gateway/Dockerfile' in file_path: return False
if '/dlt/gateway/' in file_path: return True
if FILE_PATH_SKIPPED in file_path: return True if FILE_PATH_SKIPPED in file_path: return True
if FILE_PATH_NO_HEADER in file_path: return True if FILE_PATH_NO_HEADER in file_path: return True
if FILE_PATH_UPDATED in file_path: return True if FILE_PATH_UPDATED in file_path: return True
...@@ -103,9 +121,13 @@ def process_file( ...@@ -103,9 +121,13 @@ def process_file(
with open(file_path, encoding='UTF-8', newline='') as source: with open(file_path, encoding='UTF-8', newline='') as source:
with open(temp_file_path, 'w', encoding='UTF-8', newline='') as target: with open(temp_file_path, 'w', encoding='UTF-8', newline='') as target:
for line_in in source: for line_in in source:
line_out = process_line(line_in) if STR_NEW_COPYRIGHT in line_in:
target.write(line_out) replaced = True
replaced = replaced or (line_out != line_in) target.write(line_in)
else:
line_out = process_line(line_in)
replaced = replaced or (line_out != line_in)
target.write(line_out)
except: # pylint: disable=bare-except except: # pylint: disable=bare-except
replaced = False replaced = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment