OLD | NEW |
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 """Small utility library of python functions used by the various package | 5 """Small utility library of python functions used by the various package |
6 installers. | 6 installers. |
7 """ | 7 """ |
8 | 8 |
9 import datetime | 9 import datetime |
10 import errno | 10 import errno |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 | 179 |
180 This file either needs to be in either a subversion repository or | 180 This file either needs to be in either a subversion repository or |
181 a git repository that is sync'd to a subversion repository using git-svn.''' | 181 a git repository that is sync'd to a subversion repository using git-svn.''' |
182 run_path = os.path.dirname(os.path.abspath(__file__)) | 182 run_path = os.path.dirname(os.path.abspath(__file__)) |
183 p = subprocess.Popen('svn info', shell=True, stdout=subprocess.PIPE, | 183 p = subprocess.Popen('svn info', shell=True, stdout=subprocess.PIPE, |
184 cwd=run_path) | 184 cwd=run_path) |
185 if p.wait() != 0: | 185 if p.wait() != 0: |
186 p = subprocess.Popen('git svn info', shell=True, stdout=subprocess.PIPE, | 186 p = subprocess.Popen('git svn info', shell=True, stdout=subprocess.PIPE, |
187 cwd=run_path) | 187 cwd=run_path) |
188 if p.wait() != 0: | 188 if p.wait() != 0: |
189 raise AssertionError('Cannot determine SVN revision of this repository'); | 189 raise AssertionError('Cannot determine SVN revision of this repository') |
190 | 190 |
191 svn_info = p.communicate()[0] | 191 svn_info = p.communicate()[0] |
192 m = re.search('Revision: ([0-9]+)', svn_info) | 192 m = re.search('Revision: ([0-9]+)', svn_info) |
193 if m: | 193 if m: |
194 return int(m.group(1)) | 194 return int(m.group(1)) |
195 else: | 195 else: |
196 raise AssertionError('Cannot extract revision number from svn info') | 196 raise AssertionError('Cannot extract revision number from svn info') |
197 | 197 |
198 | 198 |
199 def VersionString(): | 199 def VersionString(): |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 Args: | 296 Args: |
297 dir: The directory to clean | 297 dir: The directory to clean |
298 ''' | 298 ''' |
299 if sys.platform != 'win32': | 299 if sys.platform != 'win32': |
300 shutil.rmtree(dir, ignore_errors=True) | 300 shutil.rmtree(dir, ignore_errors=True) |
301 else: | 301 else: |
302 # Intentionally ignore return value since a directory might be in use. | 302 # Intentionally ignore return value since a directory might be in use. |
303 subprocess.call(['rmdir', '/Q', '/S', dir], | 303 subprocess.call(['rmdir', '/Q', '/S', dir], |
304 env=os.environ.copy(), | 304 env=os.environ.copy(), |
305 shell=True) | 305 shell=True) |
OLD | NEW |