Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
bots.bot_utils.GSUtil Class Reference
Inheritance diagram for bots.bot_utils.GSUtil:

Public Member Functions

 execute (self, gsutil_args)
 
 upload (self, local_path, remote_path, recursive=False, multithread=False)
 
 cat (self, remote_path)
 
 setGroupReadACL (self, remote_path, group)
 
 setContentType (self, remote_path, content_type)
 
 remove (self, remote_path, recursive=False)
 

Static Public Attributes

 GSUTIL_PATH = None
 
bool USE_DART_REPO_VERSION = False
 

Protected Member Functions

 _layzCalculateGSUtilPath (self)
 

Detailed Description

Definition at line 56 of file bot_utils.py.

Member Function Documentation

◆ _layzCalculateGSUtilPath()

bots.bot_utils.GSUtil._layzCalculateGSUtilPath (   self)
protected

Definition at line 60 of file bot_utils.py.

60 def _layzCalculateGSUtilPath(self):
61 if not GSUtil.GSUTIL_PATH:
62 dart_gsutil = os.path.join(DART_DIR, 'third_party', 'gsutil',
63 'gsutil')
64 if os.path.isfile(dart_gsutil):
65 GSUtil.GSUTIL_PATH = dart_gsutil
66 elif GSUtil.USE_DART_REPO_VERSION:
67 raise Exception("Dart repository version of gsutil required, "
68 "but not found.")
69 else:
70 # We did not find gsutil, look in path
71 possible_locations = list(os.environ['PATH'].split(os.pathsep))
72 for directory in possible_locations:
73 location = os.path.join(directory, 'gsutil')
74 if os.path.isfile(location):
75 GSUtil.GSUTIL_PATH = location
76 break
77 assert GSUtil.GSUTIL_PATH
78

◆ cat()

bots.bot_utils.GSUtil.cat (   self,
  remote_path 
)

Definition at line 102 of file bot_utils.py.

102 def cat(self, remote_path):
103 assert remote_path.startswith('gs://')
104
105 args = ['cat', remote_path]
106 (stdout, _, _) = self.execute(args)
107 return stdout
108

◆ execute()

bots.bot_utils.GSUtil.execute (   self,
  gsutil_args 
)

Definition at line 79 of file bot_utils.py.

79 def execute(self, gsutil_args):
80 self._layzCalculateGSUtilPath()
81
82 gsutil_command = [sys.executable, GSUtil.GSUTIL_PATH]
83
84 return run(gsutil_command + gsutil_args)
85
Definition run.py:1

◆ remove()

bots.bot_utils.GSUtil.remove (   self,
  remote_path,
  recursive = False 
)

Definition at line 117 of file bot_utils.py.

117 def remove(self, remote_path, recursive=False):
118 assert remote_path.startswith('gs://')
119
120 args = ['rm']
121 if recursive:
122 args += ['-R']
123 args += [remote_path]
124 self.execute(args)

◆ setContentType()

bots.bot_utils.GSUtil.setContentType (   self,
  remote_path,
  content_type 
)

Definition at line 113 of file bot_utils.py.

113 def setContentType(self, remote_path, content_type):
114 args = ['setmeta', '-h', 'Content-Type:%s' % content_type, remote_path]
115 self.execute(args)
116

◆ setGroupReadACL()

bots.bot_utils.GSUtil.setGroupReadACL (   self,
  remote_path,
  group 
)

Definition at line 109 of file bot_utils.py.

109 def setGroupReadACL(self, remote_path, group):
110 args = ['acl', 'ch', '-g', '%s:R' % group, remote_path]
111 self.execute(args)
112

◆ upload()

bots.bot_utils.GSUtil.upload (   self,
  local_path,
  remote_path,
  recursive = False,
  multithread = False 
)

Definition at line 86 of file bot_utils.py.

90 multithread=False):
91 assert remote_path.startswith('gs://')
92
93 if multithread:
94 args = ['-m', 'cp']
95 else:
96 args = ['cp']
97 if recursive:
98 args += ['-R']
99 args += [local_path, remote_path]
100 self.execute(args)
101

Member Data Documentation

◆ GSUTIL_PATH

bots.bot_utils.GSUtil.GSUTIL_PATH = None
static

Definition at line 57 of file bot_utils.py.

◆ USE_DART_REPO_VERSION

bool bots.bot_utils.GSUtil.USE_DART_REPO_VERSION = False
static

Definition at line 58 of file bot_utils.py.


The documentation for this class was generated from the following file: