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

Side by Side Diff: client/third_party/infra_libs/event_mon/checkouts.py

Issue 2093593002: luci-py: Making __file__ usage unicode safe. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Small fixes. Created 4 years, 6 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 | « client/third_party/httplib2/__init__.py ('k') | client/tools/cost.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 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 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 # Functions in this file relies on depot_tools been checked-out as a sibling 5 # Functions in this file relies on depot_tools been checked-out as a sibling
6 # of infra.git. 6 # of infra.git.
7 7
8 import logging 8 import logging
9 import os 9 import os
10 import re 10 import re
11 import subprocess 11 import subprocess
12 12
13 13
14 BASE_DIR = os.path.dirname( 14 BASE_DIR = os.path.dirname(
15 os.path.dirname( 15 os.path.dirname(
16 os.path.dirname( 16 os.path.dirname(
17 os.path.dirname(os.path.realpath(__file__))))) 17 os.path.dirname(os.path.realpath(
18 __file__.decode(sys.getfilesystemencoding()))))))
18 19
19 20
20 def parse_revinfo(revinfo): 21 def parse_revinfo(revinfo):
21 """Parse the output of "gclient revinfo -a" 22 """Parse the output of "gclient revinfo -a"
22 23
23 Args: 24 Args:
24 revinfo (str): string containing gclient stdout. 25 revinfo (str): string containing gclient stdout.
25 26
26 Returns: 27 Returns:
27 revinfo_d (dict): <directory>: (URL, revision) 28 revinfo_d (dict): <directory>: (URL, revision)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 """ 65 """
65 66
66 cmd = [os.path.join(BASE_DIR, 'depot_tools', 'gclient'), 'revinfo', '-a'] 67 cmd = [os.path.join(BASE_DIR, 'depot_tools', 'gclient'), 'revinfo', '-a']
67 logging.debug('Running: %s', ' '.join(cmd)) 68 logging.debug('Running: %s', ' '.join(cmd))
68 revinfo = '' 69 revinfo = ''
69 try: 70 try:
70 revinfo = subprocess.check_output(cmd, cwd=cwd) 71 revinfo = subprocess.check_output(cmd, cwd=cwd)
71 except (subprocess.CalledProcessError, OSError): 72 except (subprocess.CalledProcessError, OSError):
72 logging.exception('Command failed to run: %s', ' '.join(cmd)) 73 logging.exception('Command failed to run: %s', ' '.join(cmd))
73 return parse_revinfo(revinfo) 74 return parse_revinfo(revinfo)
OLDNEW
« no previous file with comments | « client/third_party/httplib2/__init__.py ('k') | client/tools/cost.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698