Flutter Engine
The Flutter Engine
Functions
copy_path Namespace Reference

Functions

def EnsureParentExists (path)
 
def SameStat (s1, s2)
 
def SameFile (f1, f2)
 
def CopyPath (src, dst)
 
def main ()
 

Function Documentation

◆ CopyPath()

def copy_path.CopyPath (   src,
  dst 
)

Definition at line 38 of file copy_path.py.

38def CopyPath(src, dst):
39 try:
41 shutil.copytree(src, dst)
42 except OSError as exc:
43 if exc.errno == errno.ENOTDIR:
44 if not SameFile(src, dst):
45 shutil.copyfile(src, dst)
46 else:
47 raise
48
49
def SameFile(f1, f2)
Definition: copy_path.py:30
def CopyPath(src, dst)
Definition: copy_path.py:38
def EnsureParentExists(path)
Definition: copy_path.py:20

◆ EnsureParentExists()

def copy_path.EnsureParentExists (   path)

Definition at line 20 of file copy_path.py.

20def EnsureParentExists(path):
21 dir_name, _ = os.path.split(path)
22 if not os.path.exists(dir_name):
23 os.makedirs(dir_name)
24
25

◆ main()

def copy_path.main ( )

Definition at line 50 of file copy_path.py.

50def main():
51 parser = argparse.ArgumentParser()
52
53 parser.add_argument('--file-list', dest='file_list', action='store', required=True)
54
55 args = parser.parse_args()
56
57 files = open(args.file_list, 'r')
58 files_to_copy = files.read().split()
59 num_files = len(files_to_copy) // 2
60
61 for i in range(num_files):
62 CopyPath(files_to_copy[i], files_to_copy[num_files + i])
63
64 return 0
65
66
def main()
Definition: copy_path.py:50

◆ SameFile()

def copy_path.SameFile (   f1,
  f2 
)

Definition at line 30 of file copy_path.py.

30def SameFile(f1, f2):
31 if not os.path.exists(f2):
32 return False
33 s1 = os.stat(f1)
34 s2 = os.stat(f2)
35 return SameStat(s1, s2)
36
37
def SameStat(s1, s2)
Definition: copy_path.py:26

◆ SameStat()

def copy_path.SameStat (   s1,
  s2 
)

Definition at line 26 of file copy_path.py.

26def SameStat(s1, s2):
27 return s1.st_ino == s2.st_ino and s1.st_dev == s2.st_dev
28
29