tesseract v5.3.3.20231005
common Namespace Reference

Functions

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

Function Documentation

◆ GetCommandOutput()

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.

46def 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

◆ GetSvnInfo()

def common.GetSvnInfo ( )
Returns the project name and the current SVN workspace's root path.

Definition at line 55 of file common.py.

55def 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

◆ GetSvnTrunk()

def common.GetSvnTrunk ( )
Returns the current SVN workspace's trunk root path.

Definition at line 69 of file common.py.

69def GetSvnTrunk():
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 GetSvnTrunk()
Definition: common.py:69

◆ IsInGMockSvn()

def common.IsInGMockSvn ( )

Definition at line 81 of file common.py.

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

◆ IsInGTestSvn()

def common.IsInGTestSvn ( )

Definition at line 76 of file common.py.

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