5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Verify that we have proper Copyright notices on all the right files
31 Note that this is a packaging test, not a functional test, so the
32 name of this script doesn't end in *Tests.py.
42 test = TestSCons.TestSCons()
45 cwd = os.environ['SCONS_CWD']
50 expression = re.compile('Copyright.*The SCons Foundation')
51 def __init__(self, remove_list):
53 self.no_copyright = []
54 self.remove_list = remove_list
56 def visit(collect, dirname, names):
57 for r in collect.remove_list:
62 for name in map(lambda n, d=dirname: os.path.join(d, n), names):
63 if not os.path.isfile(name):
65 if collect.expression.search(open(name, 'r').read()):
66 collect.copyright.append(name)
68 collect.no_copyright.append(name)
80 'SCons-win32-install-1.jpg',
81 'SCons-win32-install-2.jpg',
82 'SCons-win32-install-3.jpg',
83 'SCons-win32-install-4.jpg',
98 # XXX Remove '*-stamp' when we get rid of those.
99 scons = Collect(remove_list + ['build-stamp', 'configure-stamp'])
100 # XXX Remove '.sconsign' when we start using SConsignFile() for SCons builds.
101 local = Collect(remove_list + ['.sconsign'])
102 src = Collect(remove_list + src_remove_list)
104 build_scons = os.path.join(cwd, 'build', 'scons')
105 build_local = os.path.join(cwd, 'build', 'scons-local')
106 build_src = os.path.join(cwd, 'build', 'scons-src')
110 if os.path.exists(build_scons):
111 os.path.walk(build_scons, visit, scons)
113 no_result.append(build_scons)
115 if os.path.exists(build_local):
116 os.path.walk(build_local, visit, local)
118 no_result.append(build_local)
120 if os.path.exists(build_src):
121 os.path.walk(build_src, visit, src)
123 no_result.append(build_src)
125 no_copyright = scons.no_copyright + local.no_copyright + src.no_copyright
128 print "Found the following files with no copyrights:"
129 print "\t" + string.join(no_copyright, "\n\t")
133 print "Cannot check copyrights, the following have apparently not been built:"
134 print "\t" + string.join(no_result, "\n\t")