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

Side by Side Diff: gclient_utils.py

Issue 14134010: Remove gclient_utils.RemoveDirectory(). (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: RemoveDirectory() -> rmtree() Created 7 years, 8 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 | « gclient_scm.py ('k') | scm.py » ('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 (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 """Generic utils.""" 5 """Generic utils."""
6 6
7 import codecs 7 import codecs
8 import logging 8 import logging
9 import os 9 import os
10 import Queue 10 import Queue
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 # would be treated regardless of what they reference. 151 # would be treated regardless of what they reference.
152 fullpath = os.path.join(path, fn) 152 fullpath = os.path.join(path, fn)
153 if os.path.islink(fullpath) or not os.path.isdir(fullpath): 153 if os.path.islink(fullpath) or not os.path.isdir(fullpath):
154 remove(os.remove, fullpath) 154 remove(os.remove, fullpath)
155 else: 155 else:
156 # Recurse. 156 # Recurse.
157 rmtree(fullpath) 157 rmtree(fullpath)
158 158
159 remove(os.rmdir, path) 159 remove(os.rmdir, path)
160 160
161 # TODO(maruel): Rename the references.
162 RemoveDirectory = rmtree
163
164 161
165 def safe_makedirs(tree): 162 def safe_makedirs(tree):
166 """Creates the directory in a safe manner. 163 """Creates the directory in a safe manner.
167 164
168 Because multiple threads can create these directories concurently, trap the 165 Because multiple threads can create these directories concurently, trap the
169 exception and pass on. 166 exception and pass on.
170 """ 167 """
171 count = 0 168 count = 0
172 while not os.path.exists(tree): 169 while not os.path.exists(tree):
173 count += 1 170 count += 1
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 764
768 Python on OSX 10.6 raises a NotImplementedError exception. 765 Python on OSX 10.6 raises a NotImplementedError exception.
769 """ 766 """
770 try: 767 try:
771 import multiprocessing 768 import multiprocessing
772 return multiprocessing.cpu_count() 769 return multiprocessing.cpu_count()
773 except: # pylint: disable=W0702 770 except: # pylint: disable=W0702
774 # Mac OS 10.6 only 771 # Mac OS 10.6 only
775 # pylint: disable=E1101 772 # pylint: disable=E1101
776 return int(os.sysconf('SC_NPROCESSORS_ONLN')) 773 return int(os.sysconf('SC_NPROCESSORS_ONLN'))
OLDNEW
« no previous file with comments | « gclient_scm.py ('k') | scm.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698