Flutter Engine
The Flutter Engine
Classes | Functions | Variables
bots.bot_utils Namespace Reference

Classes

class  GSUtil
 

Functions

def load_source (modname, filename)
 
def GetUtils ()
 
def run (command, env=None, shell=False, throw_on_error=True)
 

Variables

 DART_DIR
 

Function Documentation

◆ GetUtils()

def bots.bot_utils.GetUtils ( )
Dynamically load the tools/utils.py python module.

Definition at line 31 of file bot_utils.py.

31def GetUtils():
32 '''Dynamically load the tools/utils.py python module.'''
33 return load_source('utils', os.path.join(DART_DIR, 'tools', 'utils.py'))
34
35
static SkString load_source(skiatest::Reporter *r, const char *testFile, const char *permutationSuffix)
Definition: SkSLTest.cpp:226
def GetUtils()
Definition: bot_utils.py:31

◆ load_source()

def bots.bot_utils.load_source (   modname,
  filename 
)

Definition at line 18 of file bot_utils.py.

18def load_source(modname, filename):
19 loader = importlib.machinery.SourceFileLoader(modname, filename)
20 spec = importlib.util.spec_from_file_location(modname,
21 filename,
22 loader=loader)
23 module = importlib.util.module_from_spec(spec)
24 # The module is always executed and not cached in sys.modules.
25 # Uncomment the following line to cache the module.
26 # sys.modules[module.__name__] = module
27 loader.exec_module(module)
28 return module
29
30

◆ run()

def bots.bot_utils.run (   command,
  env = None,
  shell = False,
  throw_on_error = True 
)

Definition at line 36 of file bot_utils.py.

36def run(command, env=None, shell=False, throw_on_error=True):
37 print("Running command: ", command)
38
39 p = subprocess.Popen(command,
40 stdout=subprocess.PIPE,
41 stderr=subprocess.PIPE,
42 env=env,
43 shell=shell,
44 universal_newlines=True)
45 (stdout, stderr) = p.communicate()
46 if throw_on_error and p.returncode != 0:
47 print("Failed to execute '%s'. Exit code: %s." %
48 (command, p.returncode),
49 file=sys.stderr)
50 print("stdout: ", stdout, file=sys.stderr)
51 print("stderr: ", stderr, file=sys.stderr)
52 raise Exception("Failed to execute %s." % command)
53 return (stdout, stderr, p.returncode)
54
55
def run(command, env=None, shell=False, throw_on_error=True)
Definition: bot_utils.py:36
def print(*args, **kwargs)
Definition: run_tests.py:49

Variable Documentation

◆ DART_DIR

bots.bot_utils.DART_DIR
Initial value:
1= os.path.abspath(
2 os.path.normpath(os.path.join(__file__, '..', '..', '..')))

Definition at line 14 of file bot_utils.py.