2222import sys
2323import shutil
2424
25+
2526def find_generated_bindings (build_dir , language ):
2627 # 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 )
2829 if os .path .exists (bindings_build_dir ):
2930 return bindings_build_dir
3031
3132 # 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 )
3434 if os .path .exists (bindings_build_dir ):
3535 return bindings_build_dir
3636
3737 return None
3838
3939
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+ )
4344
4445 for root , _ , files in os .walk (generated_bindings_dir ):
4546 for file in files :
@@ -50,36 +51,40 @@ def copy_bindings(generated_bindings_dir, source_dir, language, extensions=['.cp
5051
5152
5253def 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+ )
5758
5859 args = parser .parse_args ()
5960
6061 build_dir = args .build_dir
6162 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 ))
6464 sys .exit (1 )
6565
6666 source_dir = os .path .dirname (os .path .dirname (os .path .realpath (__file__ )))
6767 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 ))
7069 sys .exit (1 )
7170
72- generated_bindings_python_dir = find_generated_bindings (build_dir , ' python' )
71+ generated_bindings_python_dir = find_generated_bindings (build_dir , " python" )
7372 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+ )
7576 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+ )
7780
78- generated_bindings_lua_dir = find_generated_bindings (build_dir , ' lua' )
81+ generated_bindings_lua_dir = find_generated_bindings (build_dir , " lua" )
7982 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+ )
8186 else :
82- copy_bindings (generated_bindings_lua_dir , source_dir , ' lua' , [' .cpp' ])
87+ copy_bindings (generated_bindings_lua_dir , source_dir , " lua" , [" .cpp" ])
8388
8489
8590if __name__ == "__main__" :
0 commit comments