@@ -20,21 +20,19 @@ def finalize_options(self):
2020def get_shared_library_data_to_include ():
2121 # Return the correct uniffi C shared library extension for the given platform
2222 include_path = "lib"
23- if platform .machine ().lower () == "x86_64" or platform .machine ().lower () == "amd64" :
23+ machine_type = platform .machine ().lower ()
24+ if machine_type in ["x86_64" , "amd64" ]:
2425 include_path = os .path .join (include_path , "x86_64" )
25- elif (
26- platform .machine ().lower () == "aarch64" or platform .machine ().lower () == "arm64"
27- ):
26+ elif machine_type in ["aarch64" , "arm64" ]:
2827 include_path = os .path .join (include_path , "aarch64" )
2928
30- c_shared_library_file_name = ""
31- if platform .system () == "Darwin" :
32- c_shared_library_file_name = "libop_uniffi_core.dylib"
33- elif platform .system () == "Linux" :
34- c_shared_library_file_name = "libop_uniffi_core.so"
35- elif platform .system () == "Windows" :
36- c_shared_library_file_name = "op_uniffi_core.dll"
37-
29+ # Map current platform to the correct shared library file name
30+ platform_to_lib = {
31+ "Darwin" : "libop_uniffi_core.dylib" ,
32+ "Linux" : "libop_uniffi_core.so" ,
33+ "Windows" : "op_uniffi_core.dll"
34+ }
35+ c_shared_library_file_name = platform_to_lib .get (platform .system (), "" )
3836 c_shared_library_file_name = os .path .join (include_path , c_shared_library_file_name )
3937
4038 uniffi_bindings_file_name = "op_uniffi_core.py"
0 commit comments