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

Side by Side Diff: tools/isolate/tree_creator.py

Issue 9621014: Separate xvfb.py logic into its own script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Save 5 lines, a variable is not needed Created 8 years, 9 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
« no previous file with comments | « tools/isolate/isolate.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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 """Creates a tree of hardlinks, symlinks or copy the inputs files.""" 5 """Creates a tree of hardlinks, symlinks or copy the inputs files."""
6 6
7 import ctypes 7 import ctypes
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 infile = os.path.normpath(os.path.join(indir, relfile)) 51 infile = os.path.normpath(os.path.join(indir, relfile))
52 if not infile.startswith(indir): 52 if not infile.startswith(indir):
53 raise MappingError('Can\'t map file %s outside %s' % (infile, indir)) 53 raise MappingError('Can\'t map file %s outside %s' % (infile, indir))
54 54
55 if relfile.endswith('/'): 55 if relfile.endswith('/'):
56 if not os.path.isdir(infile): 56 if not os.path.isdir(infile):
57 raise MappingError( 57 raise MappingError(
58 'Input directory %s must have a trailing slash' % infile) 58 'Input directory %s must have a trailing slash' % infile)
59 for dirpath, dirnames, filenames in os.walk(infile): 59 for dirpath, dirnames, filenames in os.walk(infile):
60 # Convert the absolute path to subdir + relative subdirectory. 60 # Convert the absolute path to subdir + relative subdirectory.
61 relpath = dirpath[len(infile)+1:] 61 relpath = dirpath[len(indir)+1:]
62 outfiles.extend(os.path.join(relpath, f) for f in filenames) 62 outfiles.extend(os.path.join(relpath, f) for f in filenames)
63 for index, dirname in enumerate(dirnames): 63 for index, dirname in enumerate(dirnames):
64 # Do not process blacklisted directories. 64 # Do not process blacklisted directories.
65 if blacklist(os.path.join(relpath, dirname)): 65 if blacklist(os.path.join(relpath, dirname)):
66 del dirnames[index] 66 del dirnames[index]
67 else: 67 else:
68 if not os.path.isfile(infile): 68 if not os.path.isfile(infile):
69 raise MappingError('Input file %s doesn\'t exist' % infile) 69 raise MappingError('Input file %s doesn\'t exist' % infile)
70 outfiles.append(relfile) 70 outfiles.append(relfile)
71 return outfiles, indir 71 return outfiles, indir
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 def make_writable(root, read_only): 142 def make_writable(root, read_only):
143 """Toggle the writable bit on a directory tree.""" 143 """Toggle the writable bit on a directory tree."""
144 root = os.path.abspath(root) 144 root = os.path.abspath(root)
145 for dirpath, dirnames, filenames in os.walk(root, topdown=True): 145 for dirpath, dirnames, filenames in os.walk(root, topdown=True):
146 for filename in filenames: 146 for filename in filenames:
147 _set_write_bit(os.path.join(dirpath, filename), read_only) 147 _set_write_bit(os.path.join(dirpath, filename), read_only)
148 148
149 for dirname in dirnames: 149 for dirname in dirnames:
150 _set_write_bit(os.path.join(dirpath, dirname), read_only) 150 _set_write_bit(os.path.join(dirpath, dirname), read_only)
OLDNEW
« no previous file with comments | « tools/isolate/isolate.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698