build/buildutils/checkcopyrights.py
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 15 Jul 2010 18:31:06 +0300
branchRCL_3
changeset 59 e5618cc85d74
parent 25 9ac0a0a7da70
child 80 d6dafc5d983f
permissions -rw-r--r--
Revision: v2.1.32 Kit: 2010127
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     1
#!/usr/bin/python
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     2
#
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     3
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     4
# All rights reserved.
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     5
# This component and the accompanying materials are made available
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     6
# under the terms of "Eclipse Public License v1.0"
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     7
# which accompanies this distribution, and is available
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     8
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
     9
#
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    10
# Initial Contributors:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    11
# Nokia Corporation - initial contribution.
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    12
#
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    13
# Contributors:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    14
#
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    15
# Description:
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    16
#   Checks that all the source files have a proper EPL copyright header.
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    17
#   Ignores number of known 3rd party source files and directories.
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    18
#
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    19
#   Run this script on a clean workarea in order to avoid warnings
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    20
#   about exported files and qmake generated files.
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    21
#
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    22
#   The excluded directories should be checked every now and then
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    23
#   so that there won't be other problems (like files without any header).
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    24
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    25
import sys, os, re
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    26
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    27
# Specify here the file types to be checked
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    28
checkedFileTypes = [".cpp", ".h", ".java", ".py", ".mk"]
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    29
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    30
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    31
# The copyright texts to be searched for
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    32
copyrightText1 = "Nokia Corporation and/or its subsidiary(-ies)"
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    33
copyrightText2 = "Eclipse Public License v1.0"
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    34
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    35
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    36
def main():
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    37
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    38
    root = sys.argv[1]
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    39
    if root[-1] != '\\':
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    40
        root = root + '\\'
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    41
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    42
    # Include here the directories to be ignored
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    43
    ignoredDirectories = [
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    44
        root + "javaextensions\\bluetooth\\bluecove",  # Bluecove
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    45
        root + "javacommons\\jvms\\j9\\s60\\inc",      # IBM J9
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    46
        root + "javauis\\eswt_akn",                    # eSWT checked separately
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    47
        root + "javauis\\eswt_qt",                     # eSWT checked separately
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    48
        root + "javauis\\tsrc\\fute\\eswt\\",          # eSWT checked separately
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    49
        root + "javaextensions\\webservices",          # Webservices not delivered
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    50
        root + "tools",                                # Tools not delivered
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    51
        "\\internal"                                   # Internal directories not delivered
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    52
        ]
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    53
     
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    54
    # Include here any individual files to be ignored
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    55
    ignoredFiles = [
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    56
        root + "javacommons\\jvms\\cldc_1.1.1\\javasrc\\java\\util\\Timer.java",       # Apache license
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    57
        root + "javacommons\\jvms\\cldc_1.1.1\\javasrc\\java\\util\\TimerTask.java",   # Apache license
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    58
        root + "javacommons\\jvms\\cldc_1.1.1\\tsrc\\javasrc\\com\\nokia\\mj\\test\\java\\util\\TimerTaskTest.java",   # Apache license
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    59
        root + "javacommons\\jvms\\cldc_1.1.1\\tsrc\\javasrc\\com\\nokia\\mj\\test\\java\\util\\TimerTest.java",       # Apache license
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    60
        root + "javacommons\\utils\\inc\\convertutf.h",                                # Unicode Inc.
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    61
        root + "javacommons\\utils\\src\\convertutf.cpp"                               # Unicode Inc.
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    62
    ]
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
    63
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    64
    
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    65
    def visitFun(arg, dirname, names):
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    66
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    67
        # Skip SVN directories
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    68
        if dirname.find("\\.svn") != -1:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    69
            return
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    70
        
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    71
        # Skip all the directories to be ignored 
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    72
        for dir in ignoredDirectories:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    73
            if dirname.find(dir) != -1:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    74
                names[:] = []
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    75
                # print "Ignoring directory", dirname
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    76
                return
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    77
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    78
        # Check then the files
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    79
        for f in names: 
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    80
        
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    81
            fname = dirname + "\\" + f
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    82
            
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    83
            # Skip directories
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    84
            if os.path.isdir(fname):
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    85
                continue
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    86
        
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    87
            # Skip ignored files
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    88
            found = False
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    89
            for file in ignoredFiles:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    90
                if fname.find(file) != -1:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    91
                    # print "Ignoring file", fname
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    92
                    found = True
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    93
                    break
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    94
            if found:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    95
                continue
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    96
            
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    97
            # Skip non-wanted file types
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    98
            lastDot = f.rfind(".")
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
    99
            if lastDot == -1 or not f[lastDot:] in checkedFileTypes:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   100
                # print "Ignoring file", f
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   101
                continue
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   102
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   103
            # Check if the file contains the copyright texts
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   104
            try:                       
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   105
                file = open(fname)
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   106
                
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   107
                # Search for the first text
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   108
                found = False
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   109
                line = file.readline()
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   110
                while line != "":
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   111
                    if copyrightText1 in line:
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   112
                        found = True
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   113
                        break;
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   114
                    line = file.readline()
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   115
                
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   116
                # Search the second copyright text as well
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   117
                if found:
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   118
                    found = False
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   119
                    line = file.readline()
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   120
                    while line != "":
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   121
                        if copyrightText2 in line:
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   122
                            found = True
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   123
                            break;
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   124
                        line = file.readline()
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   125
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   126
                file.close()
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   127
                                    
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   128
            except IOError:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   129
                print "Error reading the file " + fname
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   130
                
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   131
            if not found:
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   132
                print fname
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   133
                continue
59
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   134
    
e5618cc85d74 Revision: v2.1.32
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents: 25
diff changeset
   135
    os.path.walk(root, visitFun, None)
25
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   136
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   137
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   138
if __name__ == "__main__":
9ac0a0a7da70 Revision: v2.1.26
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff changeset
   139
    main()