xref: /onnv-gate/usr/src/tools/scripts/copyrightchk.py (revision 12216:5167f302c8cf)
111838SLiane.Praza@Sun.COM#!/usr/bin/python2.4
27078Smjnelson#
37078Smjnelson# CDDL HEADER START
47078Smjnelson#
57078Smjnelson# The contents of this file are subject to the terms of the
67078Smjnelson# Common Development and Distribution License (the "License").
77078Smjnelson# You may not use this file except in compliance with the License.
87078Smjnelson#
97078Smjnelson# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107078Smjnelson# or http://www.opensolaris.org/os/licensing.
117078Smjnelson# See the License for the specific language governing permissions
127078Smjnelson# and limitations under the License.
137078Smjnelson#
147078Smjnelson# When distributing Covered Code, include this CDDL HEADER in each
157078Smjnelson# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167078Smjnelson# If applicable, add the following below this CDDL HEADER, with the
177078Smjnelson# fields enclosed by brackets "[]" replaced with your own identifying
187078Smjnelson# information: Portions Copyright [yyyy] [name of copyright owner]
197078Smjnelson#
207078Smjnelson# CDDL HEADER END
217078Smjnelson#
227078Smjnelson
237078Smjnelson#
24*12216Srichlowe@richlowe.net# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
257078Smjnelson#
267078Smjnelson
277078Smjnelson#
287078Smjnelson# Check for valid SMI copyright notices in source files.
297078Smjnelson#
307078Smjnelson
317078Smjnelsonimport sys, os
327078Smjnelson
33*12216Srichlowe@richlowe.netsys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
34*12216Srichlowe@richlowe.net                                "python%d.%d" % sys.version_info[:2]))
35*12216Srichlowe@richlowe.net
36*12216Srichlowe@richlowe.net# Allow running from the source tree, using the modules in the source tree
37*12216Srichlowe@richlowe.netsys.path.insert(2, os.path.join(os.path.dirname(__file__), '..'))
387078Smjnelson
397078Smjnelsonfrom onbld.Checks.Copyright import copyright
407078Smjnelson
417078Smjnelsonret = 0
427078Smjnelsonfor filename in sys.argv[1:]:
437078Smjnelson	try:
447078Smjnelson		fin = open(filename, 'r')
457078Smjnelson	except IOError, e:
467078Smjnelson		sys.stderr.write("failed to open '%s': %s\n" %
477078Smjnelson				 (e.filename, e.strerror))
487078Smjnelson		continue
497078Smjnelson
507078Smjnelson	ret |= copyright(fin, output=sys.stdout)
517078Smjnelson	fin.close()
527078Smjnelson
537078Smjnelsonsys.exit(ret)
54