Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webkit/compositor/copyfiles.py

Issue 10920056: Make cc_unittests and webkit_compositor_unittests executable always (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename to webkit_compositor_bindings Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright (c) 2012 The Chromium Authors. 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.
4
5 import shutil
6 import os
7 import re
8
9 prefixes = ["../../third_party/WebKit/Source/WebCore/platform/chromium/support",
10 "../../third_party/WebKit/Source/WebKit/chromium/src",
11 "../../third_party/WebKit/Source/WebKit/chromium/tests",
12 "../../third_party/WebKit/Source/WebCore/platform"]
13
14 def Copy(name):
15 src = name
16 dst = name
17 fullsrc = ""
18 if name.startswith("test/"):
19 src = src[5:]
20 for prefix in prefixes:
21 candidate = "%s/%s" % (prefix, src)
22 if os.path.exists(candidate):
23 fullsrc = candidate
24 break
25 assert fullsrc != ""
26 shutil.copyfile(fullsrc, dst)
27 print "copying from %s to %s" % (fullsrc, dst)
28 return dst
29
30 def Readfile(gypfile):
31 cc_gyp = open(gypfile, "r")
32 obj = eval(cc_gyp.read())
33 cc_gyp.close()
34 return obj
35
36 def FixCopyrightHeaderText(text, year):
37 header_template = """// Copyright %s The Chromium Authors. All rights reserved .
38 // Use of this source code is governed by a BSD-style license that can be
39 // found in the LICENSE file.
40 """
41
42 while text[0].find(" */") == -1:
43 text = text[1:]
44 text = text[1:]
45
46 return (header_template % year) + "".join(text)
47
48 def FixCopyrightHeader(filepath):
49 with open(filepath, "r") as f:
50 text = f.readlines()
51
52 pattern = ".*Copyright \(C\) (20[01][0-9])"
53 m = re.match(pattern, text[0])
54 if m == None:
55 m = re.match(pattern, text[1])
56 assert m
57 year = m.group(1)
58
59 fixed_text = FixCopyrightHeaderText(text, year)
60 with open(filepath, "w") as f:
61 f.write(fixed_text)
62
63 def Main():
64 files = Readfile("compositor.gyp")['variables']['webkit_compositor_sources']
65 for f in files:
66 dst = Copy(f)
67 FixCopyrightHeader(dst)
68
69 variables = Readfile("compositor_tests.gyp")['variables']
70 files = variables['webkit_compositor_tests_sources']
71 for f in files:
72 dst = Copy(f)
73 FixCopyrightHeader(dst)
74
75 if __name__ == '__main__':
76 import sys
77 os.chdir(os.path.dirname(__file__))
78 sys.exit(Main())
OLDNEW
« no previous file with comments | « webkit/compositor/compositor_tests.gyp ('k') | webkit/compositor/stubs/public/WebTransformationMatrix.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698