proxygen
common Namespace Reference

Functions

def GetCommandOutput (command)
 
def GetSvnInfo ()
 
def GetSvnTrunk ()
 
def IsInGTestSvn ()
 
def IsInGMockSvn ()
 

Variables

string __author__ = 'wan@google.com (Zhanyong Wan)'
 
 _SVN_INFO_URL_RE = re.compile(r'^URL: https://(\w+)\.googlecode\.com/svn(.*)')
 

Function Documentation

def common.GetCommandOutput (   command)
Runs the shell command and returns its stdout as a list of lines.

Definition at line 46 of file common.py.

Referenced by GetSvnInfo().

46 def GetCommandOutput(command):
47  """Runs the shell command and returns its stdout as a list of lines."""
48 
49  f = os.popen(command, 'r')
50  lines = [line.strip() for line in f.readlines()]
51  f.close()
52  return lines
53 
54 
def GetCommandOutput(command)
Definition: common.py:46
def common.GetSvnInfo ( )
Returns the project name and the current SVN workspace's root path.

Definition at line 55 of file common.py.

References GetCommandOutput().

Referenced by release_docs.WikiBrancher.__init__(), GetSvnTrunk(), IsInGMockSvn(), and IsInGTestSvn().

55 def GetSvnInfo():
56  """Returns the project name and the current SVN workspace's root path."""
57 
58  for line in GetCommandOutput('svn info .'):
59  m = _SVN_INFO_URL_RE.match(line)
60  if m:
61  project = m.group(1) # googletest or googlemock
62  rel_path = m.group(2)
63  root = os.path.realpath(rel_path.count('/') * '../')
64  return project, root
65 
66  return None, None
67 
68 
def GetSvnInfo()
Definition: common.py:55
def GetCommandOutput(command)
Definition: common.py:46
def common.GetSvnTrunk ( )
Returns the current SVN workspace's trunk root path.

Definition at line 69 of file common.py.

References GetSvnInfo().

70  """Returns the current SVN workspace's trunk root path."""
71 
72  _, root = GetSvnInfo()
73  return root + '/trunk' if root else None
74 
75 
def GetSvnInfo()
Definition: common.py:55
def GetSvnTrunk()
Definition: common.py:69
def common.IsInGMockSvn ( )

Definition at line 81 of file common.py.

References GetSvnInfo().

82  project, _ = GetSvnInfo()
83  return project == 'googlemock'
84 
def GetSvnInfo()
Definition: common.py:55
def IsInGMockSvn()
Definition: common.py:81
def common.IsInGTestSvn ( )

Definition at line 76 of file common.py.

References GetSvnInfo().

77  project, _ = GetSvnInfo()
78  return project == 'googletest'
79 
80 
def GetSvnInfo()
Definition: common.py:55
def IsInGTestSvn()
Definition: common.py:76

Variable Documentation

string common.__author__ = 'wan@google.com (Zhanyong Wan)'
private

Definition at line 31 of file common.py.

common._SVN_INFO_URL_RE = re.compile(r'^URL: https://(\w+)\.googlecode\.com/svn(.*)')
private

Definition at line 43 of file common.py.