22
22
import sys
23
23
import shutil
24
24
25
+
25
26
def find_generated_bindings (build_dir , language ):
26
27
# First, see if we're in a standalone build of LLDB.
27
- bindings_build_dir = os .path .join (build_dir , ' bindings' , language )
28
+ bindings_build_dir = os .path .join (build_dir , " bindings" , language )
28
29
if os .path .exists (bindings_build_dir ):
29
30
return bindings_build_dir
30
31
31
32
# Failing that, check if it's a unified build (i.e. build with LLVM+Clang)
32
- bindings_build_dir = os .path .join (build_dir , 'tools' , 'lldb' , 'bindings' ,
33
- language )
33
+ bindings_build_dir = os .path .join (build_dir , "tools" , "lldb" , "bindings" , language )
34
34
if os .path .exists (bindings_build_dir ):
35
35
return bindings_build_dir
36
36
37
37
return None
38
38
39
39
40
- def copy_bindings (generated_bindings_dir , source_dir , language , extensions = ['.cpp' ]):
41
- binding_source_dir = os .path .join (source_dir , 'bindings' , language ,
42
- 'static-binding' )
40
+ def copy_bindings (generated_bindings_dir , source_dir , language , extensions = [".cpp" ]):
41
+ binding_source_dir = os .path .join (
42
+ source_dir , "bindings" , language , "static-binding"
43
+ )
43
44
44
45
for root , _ , files in os .walk (generated_bindings_dir ):
45
46
for file in files :
@@ -50,36 +51,40 @@ def copy_bindings(generated_bindings_dir, source_dir, language, extensions=['.cp
50
51
51
52
52
53
def main ():
53
- parser = argparse .ArgumentParser (description = ' Copy the static bindings' )
54
- parser .add_argument ('build_dir' ,
55
- type = str ,
56
- help = 'Path to the root of the LLDB build directory' )
54
+ parser = argparse .ArgumentParser (description = " Copy the static bindings" )
55
+ parser .add_argument (
56
+ "build_dir" , type = str , help = "Path to the root of the LLDB build directory"
57
+ )
57
58
58
59
args = parser .parse_args ()
59
60
60
61
build_dir = args .build_dir
61
62
if not os .path .exists (build_dir ):
62
- print ("error: the build directory does not exist: {}" .format (
63
- args .build_dir ))
63
+ print ("error: the build directory does not exist: {}" .format (args .build_dir ))
64
64
sys .exit (1 )
65
65
66
66
source_dir = os .path .dirname (os .path .dirname (os .path .realpath (__file__ )))
67
67
if not os .path .exists (source_dir ):
68
- print ("error: the source directory does not exist: {}" .format (
69
- source_dir ))
68
+ print ("error: the source directory does not exist: {}" .format (source_dir ))
70
69
sys .exit (1 )
71
70
72
- generated_bindings_python_dir = find_generated_bindings (build_dir , ' python' )
71
+ generated_bindings_python_dir = find_generated_bindings (build_dir , " python" )
73
72
if generated_bindings_python_dir is None :
74
- print ("error: unable to locate the python bindings in the build directory" )
73
+ print (
74
+ "warning: Python bindings skipped: unable to locate the Python bindings in the build directory"
75
+ )
75
76
else :
76
- copy_bindings (generated_bindings_python_dir , source_dir , 'python' , ['.py' , '.cpp' ])
77
+ copy_bindings (
78
+ generated_bindings_python_dir , source_dir , "python" , [".py" , ".cpp" ]
79
+ )
77
80
78
- generated_bindings_lua_dir = find_generated_bindings (build_dir , ' lua' )
81
+ generated_bindings_lua_dir = find_generated_bindings (build_dir , " lua" )
79
82
if generated_bindings_lua_dir is None :
80
- print ("error: unable to locate the lua bindings in the build directory" )
83
+ print (
84
+ "warning: Lua bindings skipped: unable to locate the Lua bindings in the build directory"
85
+ )
81
86
else :
82
- copy_bindings (generated_bindings_lua_dir , source_dir , ' lua' , [' .cpp' ])
87
+ copy_bindings (generated_bindings_lua_dir , source_dir , " lua" , [" .cpp" ])
83
88
84
89
85
90
if __name__ == "__main__" :
0 commit comments