aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAnthony Barbier <anthony.barbier@arm.com>2018-12-19 11:51:09 +0000
committerAnthony Barbier <Anthony.barbier@arm.com>2018-12-19 16:14:17 +0000
commitf7d418c37e693c1693596bfa6e9ccbcea7c0b544 (patch)
treea3fe4354a1c6b2a81b7c1bfa97a711408a769ea3 /scripts
parent08ddd7b1c6c6c08361115142eb58e43267d5f264 (diff)
downloadComputeLibrary-f7d418c37e693c1693596bfa6e9ccbcea7c0b544.tar.gz
COMPMID-1857: Updated script to add copyright headers
Change-Id: Id52f92249d55ad0212fa77e37a47a95192e477ac Reviewed-on: https://review.mlplatform.org/422 Reviewed-by: Isabella Gottardi <isabella.gottardi@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/add_copyright.py50
-rw-r--r--scripts/copyright_mit.txt2
2 files changed, 30 insertions, 22 deletions
diff --git a/scripts/add_copyright.py b/scripts/add_copyright.py
index ad1dab6f40..9585fa3d3e 100755
--- a/scripts/add_copyright.py
+++ b/scripts/add_copyright.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python3
import glob
import os.path
+import sys
mit_copyright = open("scripts/copyright_mit.txt",'r').read()
@@ -56,27 +57,34 @@ def remove_comment_python( content ):
out += line + "\n"
return out
-for top in ['./arm_compute', './tests','./src','./examples','./utils/','./framework','./support']:
- for root, _, files in os.walk(top):
- for f in files:
- path = os.path.join(root, f)
+def check_file( path ):
+ root, f = os.path.split(path)
+ if f in ['.clang-tidy', '.clang-format']:
+ print("Skipping file: {}".format(path))
+ return
- if f in ['.clang-tidy', '.clang-format']:
- print("Skipping file: {}".format(path))
- continue
+ with open(path, 'r', encoding='utf-8') as fd:
+ content = fd.read()
+ _, extension = os.path.splitext(f)
- with open(path, 'r', encoding='utf-8') as fd:
- content = fd.read()
- _, extension = os.path.splitext(f)
+ if extension in ['.cpp', '.h', '.hpp', '.inl', '.cl', '.in', '.cs']:
+ if not content.startswith('/*'):
+ add_cpp_copyright(path, content)
+ elif extension == '.py' or f in ['SConstruct', 'SConscript']:
+ if not content.startswith('# Copyright'):
+ add_python_copyright(path, content)
+ elif f == 'CMakeLists.txt':
+ if not content.startswith('# Copyright'):
+ add_python_copyright(path, content)
+ else:
+ raise Exception("Unhandled file: {}".format(path))
- if extension in ['.cpp', '.h', '.hpp', '.inl', '.cl']:
- if not content.startswith('/*'):
- add_cpp_copyright(path, content)
- elif extension == '.py' or f in ['SConstruct', 'SConscript']:
- if not content.startswith('# Copyright'):
- add_python_copyright(path, content)
- elif f == 'CMakeLists.txt':
- if not content.startswith('# Copyright'):
- add_python_copyright(path, content)
- else:
- raise Exception("Unhandled file: {}".format(path))
+if len(sys.argv) > 1:
+ for path in sys.argv[1:]:
+ check_file(path)
+else:
+ for top in ['./arm_compute', './tests','./src','./examples','./utils/','./opencl-1.2-stubs/','./opengles-3.1-stubs/','./support']:
+ for root, _, files in os.walk(top):
+ for f in files:
+ path = os.path.join(root, f)
+ check_file(path)
diff --git a/scripts/copyright_mit.txt b/scripts/copyright_mit.txt
index 18e83ec163..a43ef66bda 100644
--- a/scripts/copyright_mit.txt
+++ b/scripts/copyright_mit.txt
@@ -1,4 +1,4 @@
-Copyright (c) 2017 ARM Limited.
+Copyright (c) 2018 ARM Limited.
SPDX-License-Identifier: MIT