17078Smjnelson#! /usr/bin/python 27078Smjnelson 37078SmjnelsonCDDL = ''' 47078SmjnelsonCDDL HEADER START 57078Smjnelson 67078SmjnelsonThe contents of this file are subject to the terms of the 77078SmjnelsonCommon Development and Distribution License (the "License"). 87078SmjnelsonYou may not use this file except in compliance with the License. 97078Smjnelson 107078SmjnelsonYou can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 117078Smjnelsonor http://www.opensolaris.org/os/licensing. 127078SmjnelsonSee the License for the specific language governing permissions 137078Smjnelsonand limitations under the License. 147078Smjnelson 157078SmjnelsonWhen distributing Covered Code, include this CDDL HEADER in each 167078Smjnelsonfile and include the License file at usr/src/OPENSOLARIS.LICENSE. 177078SmjnelsonIf applicable, add the following below this CDDL HEADER, with the 187078Smjnelsonfields enclosed by brackets "[]" replaced with your own identifying 197078Smjnelsoninformation: Portions Copyright [yyyy] [name of copyright owner] 207078Smjnelson 217078SmjnelsonCDDL HEADER END 227078Smjnelson''' 237078Smjnelson 247078Smjnelson# 25*8744SAli.Bahrami@Sun.COM# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 267078Smjnelson# Use is subject to license terms. 277078Smjnelson# 287078Smjnelson 297078Smjnelson# 30*8744SAli.Bahrami@Sun.COM# Check that source files contain a valid CDDL block 317078Smjnelson# 327078Smjnelson 33*8744SAli.Bahrami@Sun.COMimport sys, CmtBlk 347078Smjnelson 35*8744SAli.Bahrami@Sun.COM# scmtest has a test for cddlchk that depends on the variable 36*8744SAli.Bahrami@Sun.COM# Cddl.CmntChrs. However, that variable has been refactored into 37*8744SAli.Bahrami@Sun.COM# CmtBlk. The following line preserves the original interface 38*8744SAli.Bahrami@Sun.COM# from the Cddl module, and allows existing programs that assume 39*8744SAli.Bahrami@Sun.COM# Cddl.CmntChrs exists to continue working. 40*8744SAli.Bahrami@Sun.COM# 41*8744SAli.Bahrami@Sun.COMCmntChrs = CmtBlk.CmntChrs 427078Smjnelson 43*8744SAli.Bahrami@Sun.COM# The CDDL string above contains the block guards so that the text will 44*8744SAli.Bahrami@Sun.COM# be tested by cddlchk. However, we don't want to include the initial 45*8744SAli.Bahrami@Sun.COM# \n or the block guards in the text passed in. 46*8744SAli.Bahrami@Sun.COM# 47*8744SAli.Bahrami@Sun.COMCDDL = CDDL.splitlines()[3:-2] 487078Smjnelson 497078Smjnelsondef cddlchk(fh, filename=None, lenient=False, verbose=False, output=sys.stderr): 50*8744SAli.Bahrami@Sun.COM return CmtBlk.cmtblkchk(fh, 'CDDL', CDDL, filename=filename, 51*8744SAli.Bahrami@Sun.COM lenient=lenient, verbose=verbose, output=output) 52