This repository was archived by the owner on Feb 6, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathhost.py
More file actions
104 lines (97 loc) · 4.33 KB
/
host.py
File metadata and controls
104 lines (97 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
from sys import platform
from shutil import copyfile
import helpers
import subprocess
class Host( object ):
def GetRunUATPath( self ):
return ""
def GetUnrealBuildToolPath( self ):
return ""
def GetCopyExecutable( self ):
return ""
def GetCopyFilesArguments( self ):
return []
def GetCopyDirectoriesArguments( self ):
return []
def CopyFile( self, source, destination ):
print( "Copy file from " + source + " to " + destination )
copyfile( source, destination )
def CopyDirectories( self, source, destination ):
print( "Copy directories from " + source + " to " + destination )
arguments = [ source, destination ]
arguments.extend( self.GetCopyDirectoriesArguments() )
return helpers.StartProcess( self.GetCopyExecutable(), arguments )
class HostLinux( Host ):
def GetRunUATPath( self ):
return "Engine/Build/BatchFiles/RunUAT.sh"
def GetUnrealBuildToolPath( self ):
return "Engine/Binaries/Linux/UnrealBuildTool"
def GetCopyExecutable( self ):
return "cp"
def GetCopyFilesArguments( self ):
return []
def GetCopyDirectoriesArguments( self ):
return []
class HostWindows( Host ):
def GetRunUATPath( self ):
return "Engine\\Build\\BatchFiles\\RunUAT.bat"
def GetUnrealBuildToolPath( self ):
return "Engine\\Binaries\\DotNET\\UnrealBuildTool.exe"
def GetCopyExecutable( self ):
return "robocopy"
def GetCopyFilesArguments( self ):
return [ "/FFT", "/R:3", "/W:10", "/Z", "/NP" ]
def GetCopyDirectoriesArguments( self ):
return [ "/E", "/FFT", "/R:3", "/W:10", "/Z", "/NP", "/NDL" ]
def CopyDirectories( self, source, destination ):
print( "Copy directories from " + source + " to " + destination )
arguments = [ source, destination ]
arguments.extend( self.GetCopyDirectoriesArguments() )
try:
return helpers.StartProcess( self.GetCopyExecutable(), arguments )
except subprocess.CalledProcessError as e:
if not self.__ProcessReturnCode( e.returncode ):
raise e
def __ProcessReturnCode( self, return_code ):
switcher = {
16 : { "message" : "***FATAL ERROR***", "success" : "false" },
15 : { "message" : "OKCOPY + FAIL + MISMATCHES + XTRA", "success" : "false" },
14 : { "message" : "FAIL + MISMATCHES + XTRA", "success" : "false" },
13 : { "message" : "OKCOPY + FAIL + MISMATCHES", "success" : "false" },
12 : { "message" : "FAIL + MISMATCHE", "success" : "false" },
11 : { "message" : "OKCOPY + FAIL + XTRA", "success" : "false" },
10 : { "message" : "FAIL + XTRA", "success" : "false" },
9 : { "message" : "OKCOPY + FAIL", "success" : "false" },
8 : { "message" : "FAIL", "success" : "false" },
7 : { "message" : "OKCOPY + MISMATCHES + XTRA", "success" : "true" },
6 : { "message" : "MISMATCHES + XTRA", "success" : "true" },
5 : { "message" : "OKCOPY + MISMATCHES", "success" : "true" },
4 : { "message" : "MISMATCHES", "success" : "true" },
3 : { "message" : "OKCOPY + XTRA", "success" : "true" },
2 : { "message" : "XTRA", "success" : "true" },
1 : { "message" : "OKCOPY", "success" : "true" },
0 : { "message" : "No Change", "success" : "true" }
}
value = switcher.get( return_code )
helpers.PrintIsolatedMessage( value[ "message"] )
return value[ "success" ] == "true"
class HostOSX( Host ):
def GetRunUATPath( self ):
return "Engine/Build/BatchFiles/RunUAT.sh"
def GetUnrealBuildToolPath( self ):
return "Engine/Binaries/Linux/UnrealBuildTool"
def GetCopyExecutable( self ):
return "cp"
def GetCopyFilesArguments( self ):
return []
def GetCopyDirectoriesArguments( self ):
return []
class HostFactory( object ):
@staticmethod
def CreateHost():
if platform == "linux" or platform == "linux2":
return HostLinux()
elif platform == 'win32' or platform == "cygwin":
return HostWindows()
elif platform == "darwin":
return HostOSX()