Flutter Engine
The Flutter Engine
Functions
gather_flutter_runner_artifacts Namespace Reference

Functions

def EnsureParentExists (path)
 
def CopyPath (src, dst)
 
def CreateMetaPackage (dst_root, far_name)
 
def GatherArtifacts (src_root, dst_root, create_meta_package=True)
 
def main ()
 

Function Documentation

◆ CopyPath()

def gather_flutter_runner_artifacts.CopyPath (   src,
  dst 
)

Definition at line 31 of file gather_flutter_runner_artifacts.py.

31def CopyPath(src, dst):
32 try:
34 shutil.copytree(src, dst)
35 except OSError as exc:
36 if exc.errno == errno.ENOTDIR:
37 shutil.copy(src, dst)
38 else:
39 raise
40
41

◆ CreateMetaPackage()

def gather_flutter_runner_artifacts.CreateMetaPackage (   dst_root,
  far_name 
)

Definition at line 42 of file gather_flutter_runner_artifacts.py.

42def CreateMetaPackage(dst_root, far_name):
43 meta = os.path.join(dst_root, 'meta')
44 if not os.path.isdir(meta):
45 os.makedirs(meta)
46 content = {}
47 content['name'] = far_name
48 content['version'] = '0'
49 package = os.path.join(meta, 'package')
50 with open(package, 'w') as out_file:
51 json.dump(content, out_file)
52
53

◆ EnsureParentExists()

def gather_flutter_runner_artifacts.EnsureParentExists (   path)

Definition at line 25 of file gather_flutter_runner_artifacts.py.

25def EnsureParentExists(path):
26 dir_name, _ = os.path.split(path)
27 if not os.path.exists(dir_name):
28 os.makedirs(dir_name)
29
30

◆ GatherArtifacts()

def gather_flutter_runner_artifacts.GatherArtifacts (   src_root,
  dst_root,
  create_meta_package = True 
)

Definition at line 54 of file gather_flutter_runner_artifacts.py.

54def GatherArtifacts(src_root, dst_root, create_meta_package=True):
55 if not os.path.exists(dst_root):
56 os.makedirs(dst_root)
57 else:
58 shutil.rmtree(dst_root)
59
60 for src_rel, dst_rel in _ARTIFACT_PATH_TO_DST.items():
61 src_full = os.path.join(src_root, src_rel)
62 dst_full = os.path.join(dst_root, dst_rel)
63 if not os.path.exists(src_full):
64 print('Unable to find artifact: ', str(src_full))
65 sys.exit(1)
66 CopyPath(src_full, dst_full)
67
68 if create_meta_package:
69 CreateMetaPackage(dst_root, 'flutter_runner')
70
71
def GatherArtifacts(src_root, dst_root, create_meta_package=True)
def print(*args, **kwargs)
Definition: run_tests.py:49

◆ main()

def gather_flutter_runner_artifacts.main ( )

Definition at line 72 of file gather_flutter_runner_artifacts.py.

72def main():
73 parser = argparse.ArgumentParser()
74
75 parser.add_argument('--artifacts-root', dest='artifacts_root', action='store', required=True)
76 parser.add_argument('--dest-dir', dest='dst_dir', action='store', required=True)
77
78 args = parser.parse_args()
79
80 assert os.path.exists(args.artifacts_root)
81 dst_parent = os.path.abspath(os.path.join(args.dst_dir, os.pardir))
82 assert os.path.exists(dst_parent)
83
84 GatherArtifacts(args.artifacts_root, args.dst_dir)
85 return 0
86
87