1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import os
19 import os.path
20 from qm.host import Host
21 import shutil
22
23
24
25
26
28 """A 'LocalHost' is the machine on which Python is running.
29
30 The default directory for a 'LocalHost' is the current working
31 directory for this Python process."""
32
34
35 if remote_file is None:
36 remote_file = os.path.basename(local_file)
37
38 if not self._SameFile(local_file, remote_file):
39 shutil.copy(local_file, remote_file)
40
41
44
45
46
47 return self.Run(path, arguments, environment, timeout)
48
49
51
52 return self.UploadFile(remote_file, local_file)
53
54
56 """Return true iff 'file1' and 'file2' are the same file.
57
58 returns -- True iff 'file1' and 'file2' are the same file,
59 even if they have different names."""
60
61 if not os.path.exists(file1) or not os.path.exists(file2):
62 return False
63 if hasattr(os.path, "samefile"):
64 return os.path.samefile(file1, file2)
65 return (os.path.normcase(os.path.abspath(file1))
66 == os.path.normcase(os.path.abspath(file2)))
67
68
72