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

Side by Side Diff: build/android/pylib/utils/isolator.py

Issue 1922023002: 🐻 Fix ui_base_unittests on Android Swarming (adds missing data) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gen-isolates-android
Patch Set: @classmethod Created 4 years, 7 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
« no previous file with comments | « no previous file | ui/base/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import fnmatch 5 import fnmatch
6 import glob 6 import glob
7 import os 7 import os
8 import shutil 8 import shutil
9 import sys 9 import sys
10 import tempfile 10 import tempfile
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 excluded_paths = ( 145 excluded_paths = (
146 x for y in deps_exclusion_list 146 x for y in deps_exclusion_list
147 for x in glob.glob( 147 for x in glob.glob(
148 os.path.abspath(os.path.join(self._isolate_deps_dir, y)))) 148 os.path.abspath(os.path.join(self._isolate_deps_dir, y))))
149 for p in excluded_paths: 149 for p in excluded_paths:
150 if os.path.isdir(p): 150 if os.path.isdir(p):
151 shutil.rmtree(p) 151 shutil.rmtree(p)
152 else: 152 else:
153 os.remove(p) 153 os.remove(p)
154 154
155 @classmethod
156 def _DestructiveMerge(cls, src, dest):
157 if os.path.exists(dest) and os.path.isdir(dest):
158 for p in os.listdir(src):
159 cls._DestructiveMerge(os.path.join(src, p), os.path.join(dest, p))
160 os.rmdir(src)
161 else:
162 shutil.move(src, dest)
163
164
155 def MoveOutputDeps(self): 165 def MoveOutputDeps(self):
156 """Moves files from the output directory to the top level of 166 """Moves files from the output directory to the top level of
157 |self._isolate_deps_dir|. 167 |self._isolate_deps_dir|.
158 168
159 Moves pak files from the output directory to to <isolate_deps_dir>/paks 169 Moves pak files from the output directory to to <isolate_deps_dir>/paks
160 Moves files from the product directory to <isolate_deps_dir> 170 Moves files from the product directory to <isolate_deps_dir>
161 """ 171 """
162 # On Android, all pak files need to be in the top-level 'paks' directory. 172 # On Android, all pak files need to be in the top-level 'paks' directory.
163 paks_dir = os.path.join(self._isolate_deps_dir, 'paks') 173 paks_dir = os.path.join(self._isolate_deps_dir, 'paks')
164 os.mkdir(paks_dir) 174 os.mkdir(paks_dir)
165 175
166 deps_out_dir = os.path.join( 176 deps_out_dir = os.path.join(
167 self._isolate_deps_dir, 177 self._isolate_deps_dir,
168 os.path.relpath(os.path.join(constants.GetOutDirectory(), os.pardir), 178 os.path.relpath(os.path.join(constants.GetOutDirectory(), os.pardir),
169 host_paths.DIR_SOURCE_ROOT)) 179 host_paths.DIR_SOURCE_ROOT))
170 for root, _, filenames in os.walk(deps_out_dir): 180 for root, _, filenames in os.walk(deps_out_dir):
171 for filename in fnmatch.filter(filenames, '*.pak'): 181 for filename in fnmatch.filter(filenames, '*.pak'):
172 shutil.move(os.path.join(root, filename), paks_dir) 182 shutil.move(os.path.join(root, filename), paks_dir)
173 183
174 # Move everything in PRODUCT_DIR to top level. 184 # Move everything in PRODUCT_DIR to top level.
175 deps_product_dir = os.path.join( 185 deps_product_dir = os.path.join(
176 deps_out_dir, os.path.basename(constants.GetOutDirectory())) 186 deps_out_dir, os.path.basename(constants.GetOutDirectory()))
177 if os.path.isdir(deps_product_dir): 187 if os.path.isdir(deps_product_dir):
178 for p in os.listdir(deps_product_dir): 188 for p in os.listdir(deps_product_dir):
179 shutil.move(os.path.join(deps_product_dir, p), self._isolate_deps_dir) 189 Isolator._DestructiveMerge(os.path.join(deps_product_dir, p),
190 os.path.join(self._isolate_deps_dir, p))
180 os.rmdir(deps_product_dir) 191 os.rmdir(deps_product_dir)
181 os.rmdir(deps_out_dir) 192 os.rmdir(deps_out_dir)
OLDNEW
« no previous file with comments | « no previous file | ui/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698