Salome HOME
test modification of mesh not generated with HYDRO
[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
10   if theFile=='src/HYDRO_tests/test_HYDROData_LandCoverMap.cxx':
11     return True; #in the file the unicode is used
12
13   #print 'Checking %s...' % theFile
14   aLines = open( theFile, 'r' ).readlines()
15   if( len( aLines )==0 ):
16     print('Empty file: ', theFile)
17     return False
18
19   aFirstLine = aLines[0][:-1]
20   aSecondLine = aLines[1][:-1]
21   if( aFirstLine != theCopyright_line1 or aSecondLine != theCopyright_line2 ):
22     print('Incorrect copyright in the', theFile)
23  
24
25 def check_folder( theFolder ):
26   aFiles = os.listdir( theFolder ); 
27   aHeaders = [x for x in aFiles if x.endswith('.h')];
28   aSources = [x for x in aFiles if x.endswith('.cxx')];
29   aSIPs = [x for x in aFiles if x.endswith('.sip')];
30   for aHeader in aHeaders:
31     check_file( theFolder + '/' + aHeader )
32   for aSource in aSources:
33     check_file( theFolder + '/' + aSource )
34   for aSIP in aSIPs:
35     check_file( theFolder + '/' + aSIP )
36
37
38 check_folder( 'src/HYDROData' )
39 check_folder( 'src/HYDROGUI' )
40 check_folder( 'src/HYDROPy' )
41 check_folder( 'src/HYDRO_tests' )