1 # Copyright (c) 2012 Google Inc. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
9 prefixes
= ["../third_party/WebKit/Source/WebCore/platform/graphics/chromium",
10 "../third_party/WebKit/Source/WebCore/platform/graphics/chromium/cc",
11 "../third_party/WebKit/Source/WebKit/chromium/tests"]
16 if name
.startswith("test/"):
19 for prefix
in prefixes
:
20 candidate
= "%s/%s" % (prefix
, src
)
21 if os
.path
.exists(candidate
):
25 shutil
.copyfile(fullsrc
, dst
)
26 print "copying from %s to %s" % (fullsrc
, dst
)
29 def FixCopyrightHeaderText(text
, year
):
30 header_template
= """// Copyright %s The Chromium Authors. All rights reserved.
31 // Use of this source code is governed by a BSD-style license that can be
32 // found in the LICENSE file.
35 while text
[0].find(" */") == -1:
39 return (header_template
% year
) + "".join(text
)
41 def FixCopyrightHeader(filepath
):
42 with
open(filepath
, "r") as f
:
45 if filepath
.endswith("CCPageScaleAnimation.cpp"):
48 pattern
= ".*Copyright \(C\) (20[01][0-9])"
49 m
= re
.match(pattern
, text
[0])
51 m
= re
.match(pattern
, text
[1])
55 fixed_text
= FixCopyrightHeaderText(text
, year
)
56 with
open(filepath
, "w") as f
:
59 def Readfile(gypfile
):
60 with
open(gypfile
, "r") as cc_gyp
:
61 obj
= eval(cc_gyp
.read())
67 FixCopyrightHeader(dst
)
70 CopyFiles(Readfile("cc.gyp")['variables']['cc_source_files'])
71 CopyFiles(Readfile("cc_tests.gyp")['variables']['cc_tests_source_files'])
72 CopyFiles(Readfile("cc_tests.gyp")['variables']['cc_tests_support_files'])
74 if __name__
== '__main__':
76 os
.chdir(os
.path
.dirname(__file__
))