Merge commit '0b09d754d66bb2026be92bbbc38f7c8ba454cf0c'
[unleashed.git] / usr / src / tools / onbld / Checks / Cddl.py
blob1f5f99f953a20c8a4af52072b9e98aded5c44b2c
1 #! /usr/bin/python
3 CDDL = '''
4 CDDL HEADER START
6 The contents of this file are subject to the terms of the
7 Common Development and Distribution License (the "License").
8 You may not use this file except in compliance with the License.
10 You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 or http://www.opensolaris.org/os/licensing.
12 See the License for the specific language governing permissions
13 and limitations under the License.
15 When distributing Covered Code, include this CDDL HEADER in each
16 file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 If applicable, add the following below this CDDL HEADER, with the
18 fields enclosed by brackets "[]" replaced with your own identifying
19 information: Portions Copyright [yyyy] [name of copyright owner]
21 CDDL HEADER END
22 '''
25 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
26 # Use is subject to license terms.
30 # Check that source files contain a valid CDDL block
33 import sys, CmtBlk
35 # scmtest has a test for cddlchk that depends on the variable
36 # Cddl.CmntChrs. However, that variable has been refactored into
37 # CmtBlk. The following line preserves the original interface
38 # from the Cddl module, and allows existing programs that assume
39 # Cddl.CmntChrs exists to continue working.
41 CmntChrs = CmtBlk.CmntChrs
43 # The CDDL string above contains the block guards so that the text will
44 # be tested by cddlchk. However, we don't want to include the initial
45 # \n or the block guards in the text passed in.
47 CDDL = CDDL.splitlines()[3:-2]
49 def cddlchk(fh, filename=None, lenient=False, verbose=False, output=sys.stderr):
50 return CmtBlk.cmtblkchk(fh, 'CDDL', CDDL, filename=filename,
51 lenient=lenient, verbose=verbose, output=output)