Salome HOME
pouet
[modules/hydro.git] / check_copyright.py
1
2 import os
3
4 theCopyright_line1 = '// Copyright (C) 2014-2015  EDF-R&D'
5 theCopyright_line2 = '// This library is free software; you can redistribute it and/or'
6
7 def check_file( theFile ):
8   global files
9   #print 'Checking %s...' % theFile
10   aLines = open( theFile, 'r' ).readlines()
11   if( len( aLines )==0 ):
12     print 'Empty file: ', theFile
13     return False
14
15   aFirstLine = aLines[0][:-1]
16   aSecondLine = aLines[1][:-1]
17   if( aFirstLine != theCopyright_line1 or aSecondLine != theCopyright_line2 ):
18     print 'Incorrect copyright in the', theFile
19  
20
21 def check_folder( theFolder ):
22   aFiles = os.listdir( theFolder ); 
23   aHeaders = filter( lambda x: x.endswith('.h'), aFiles );
24   aSources = filter( lambda x: x.endswith('.cxx'), aFiles );
25   aSIPs = filter( lambda x: x.endswith('.sip'), aFiles );
26   for aHeader in aHeaders:
27     check_file( theFolder + '/' + aHeader )
28   for aSource in aSources:
29     check_file( theFolder + '/' + aSource )
30   for aSIP in aSIPs:
31     check_file( theFolder + '/' + aSIP )
32
33
34 check_folder( 'src/HYDROData' )
35 check_folder( 'src/HYDROGUI' )
36 check_folder( 'src/HYDROPy' )