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

Side by Side Diff: third_party/WebKit/Source/devtools/PRESUBMIT.py

Issue 2441163002: DevTools: clean up scripts folder (Closed)
Patch Set: Fix sys.path for chromevox to load rjsmin Created 4 years, 1 month 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
OLDNEW
1 # Copyright (C) 2014 Google Inc. All rights reserved. 1 # Copyright (C) 2014 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 return [output_api.PresubmitPromptWarning(out + compile_note)] 96 return [output_api.PresubmitPromptWarning(out + compile_note)]
97 return [] 97 return []
98 98
99 99
100 def _CheckConvertSVGToPNGHashes(input_api, output_api): 100 def _CheckConvertSVGToPNGHashes(input_api, output_api):
101 if not input_api.platform.startswith('linux'): 101 if not input_api.platform.startswith('linux'):
102 return [] 102 return []
103 103
104 original_sys_path = sys.path 104 original_sys_path = sys.path
105 try: 105 try:
106 sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPa th(), 'scripts')] 106 sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPa th(), 'scripts', 'build')]
107 import devtools_file_hashes 107 import devtools_file_hashes
108 finally: 108 finally:
109 sys.path = original_sys_path 109 sys.path = original_sys_path
110 110
111 absolute_local_paths = [af.AbsoluteLocalPath() for af in input_api.AffectedF iles(include_deletes=False)] 111 absolute_local_paths = [af.AbsoluteLocalPath() for af in input_api.AffectedF iles(include_deletes=False)]
112 images_src_path = input_api.os_path.join("devtools", "front_end", "Images", "src") 112 images_src_path = input_api.os_path.join("devtools", "front_end", "Images", "src")
113 image_source_file_paths = [path for path in absolute_local_paths if images_s rc_path in path and path.endswith(".svg")] 113 image_source_file_paths = [path for path in absolute_local_paths if images_s rc_path in path and path.endswith(".svg")]
114 image_sources_path = input_api.os_path.join(input_api.PresubmitLocalPath(), "front_end", "Images", "src") 114 image_sources_path = input_api.os_path.join(input_api.PresubmitLocalPath(), "front_end", "Images", "src")
115 hashes_file_name = "svg2png.hashes" 115 hashes_file_name = "svg2png.hashes"
116 hashes_file_path = input_api.os_path.join(image_sources_path, hashes_file_na me) 116 hashes_file_path = input_api.os_path.join(image_sources_path, hashes_file_na me)
117 invalid_hash_file_paths = devtools_file_hashes.files_with_invalid_hashes(has hes_file_path, image_source_file_paths) 117 invalid_hash_file_paths = devtools_file_hashes.files_with_invalid_hashes(has hes_file_path, image_source_file_paths)
118 if len(invalid_hash_file_paths) == 0: 118 if len(invalid_hash_file_paths) == 0:
119 return [] 119 return []
120 invalid_hash_file_names = [input_api.os_path.basename(file_path) for file_pa th in invalid_hash_file_paths] 120 invalid_hash_file_names = [input_api.os_path.basename(file_path) for file_pa th in invalid_hash_file_paths]
121 file_paths_str = ", ".join(invalid_hash_file_names) 121 file_paths_str = ", ".join(invalid_hash_file_names)
122 error_message = "The following SVG files should be converted to PNG using co nvert_svg_images_png.py script before uploading: \n - %s" % file_paths_str 122 error_message = "The following SVG files should be converted to PNG using co nvert_svg_images_png.py script before uploading: \n - %s" % file_paths_str
123 return [output_api.PresubmitError(error_message)] 123 return [output_api.PresubmitError(error_message)]
124 124
125 125
126 def _CheckOptimizePNGHashes(input_api, output_api): 126 def _CheckOptimizePNGHashes(input_api, output_api):
127 if not input_api.platform.startswith('linux'): 127 if not input_api.platform.startswith('linux'):
128 return [] 128 return []
129 129
130 original_sys_path = sys.path 130 original_sys_path = sys.path
131 try: 131 try:
132 sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPa th(), 'scripts')] 132 sys.path = sys.path + [input_api.os_path.join(input_api.PresubmitLocalPa th(), 'scripts', 'build')]
133 import devtools_file_hashes 133 import devtools_file_hashes
134 finally: 134 finally:
135 sys.path = original_sys_path 135 sys.path = original_sys_path
136 136
137 absolute_local_paths = [af.AbsoluteLocalPath() for af in input_api.AffectedF iles(include_deletes=False)] 137 absolute_local_paths = [af.AbsoluteLocalPath() for af in input_api.AffectedF iles(include_deletes=False)]
138 images_src_path = input_api.os_path.join("devtools", "front_end", "Images", "src") 138 images_src_path = input_api.os_path.join("devtools", "front_end", "Images", "src")
139 image_source_file_paths = [path for path in absolute_local_paths if images_s rc_path in path and path.endswith(".svg")] 139 image_source_file_paths = [path for path in absolute_local_paths if images_s rc_path in path and path.endswith(".svg")]
140 image_sources_path = input_api.os_path.join(input_api.PresubmitLocalPath(), "front_end", "Images", "src") 140 image_sources_path = input_api.os_path.join(input_api.PresubmitLocalPath(), "front_end", "Images", "src")
141 hashes_file_name = "optimize_png.hashes" 141 hashes_file_name = "optimize_png.hashes"
142 hashes_file_path = input_api.os_path.join(image_sources_path, hashes_file_na me) 142 hashes_file_path = input_api.os_path.join(image_sources_path, hashes_file_na me)
(...skipping 25 matching lines...) Expand all
168 results.extend(_CheckDevtoolsStyle(input_api, output_api)) 168 results.extend(_CheckDevtoolsStyle(input_api, output_api))
169 results.extend(_CompileDevtoolsFrontend(input_api, output_api)) 169 results.extend(_CompileDevtoolsFrontend(input_api, output_api))
170 results.extend(_CheckConvertSVGToPNGHashes(input_api, output_api)) 170 results.extend(_CheckConvertSVGToPNGHashes(input_api, output_api))
171 results.extend(_CheckOptimizePNGHashes(input_api, output_api)) 171 results.extend(_CheckOptimizePNGHashes(input_api, output_api))
172 results.extend(_CheckCSSViolations(input_api, output_api)) 172 results.extend(_CheckCSSViolations(input_api, output_api))
173 return results 173 return results
174 174
175 175
176 def CheckChangeOnCommit(input_api, output_api): 176 def CheckChangeOnCommit(input_api, output_api):
177 return [] 177 return []
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/devtools/BUILD.gn ('k') | third_party/WebKit/Source/devtools/scripts/CodeGeneratorFrontend.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698