@@ -21,7 +21,8 @@ def get_package_path(package_name):
2121def regenerate (build_dir , abi_dir ):
2222 for so_path in Path (build_dir ).glob ("**/*.so" ):
2323 print (f"Generating ABI from { so_path .relative_to (build_dir )} " )
24- abi_path = abi_dir / so_path .relative_to (build_dir ).with_suffix (".abi" )
24+ abi_name = so_path .stem [: so_path .stem .find ("." )] + ".abi"
25+ abi_path = abi_dir / so_path .parent .relative_to (build_dir ) / abi_name
2526 abi_path .parent .mkdir (parents = True , exist_ok = True )
2627 subprocess .run (["abidw" , so_path , "--no-architecture" , "--out-file" , abi_path ], check = True )
2728
@@ -30,8 +31,9 @@ def check(build_dir, abi_dir):
3031 found_failures = []
3132 missing_so = []
3233 for abi_path in Path (abi_dir ).glob ("**/*.abi" ):
33- so_path = Path (build_dir ) / abi_path .relative_to (abi_dir ).with_suffix (".so" )
34- if so_path .exists ():
34+ so_candidates = list ((Path (build_dir ) / abi_path .parent .relative_to (abi_dir )).glob (f"{ abi_path .stem } .*.so" ))
35+ if len (so_candidates ) == 1 :
36+ so_path = so_candidates [0 ]
3537 proc = subprocess .run (
3638 [
3739 "abidiff" ,
@@ -44,8 +46,13 @@ def check(build_dir, abi_dir):
4446 )
4547 if proc .returncode != 0 :
4648 found_failures .append (so_path )
49+ elif len (so_candidates ) == 0 :
50+ missing_so .append (abi_path )
4751 else :
48- missing_so .append (so_path )
52+ print (f"Multiple .so candidates found for { abi_path } :" )
53+ for p in so_candidates :
54+ print (f" { p } " )
55+ missing_so .append (abi_path )
4956
5057 if len (found_failures ):
5158 print ("ABI differences found in the following files:" )
@@ -55,7 +62,7 @@ def check(build_dir, abi_dir):
5562 if len (missing_so ):
5663 print ("Expected .so file(s) have been removed:" )
5764 for p in missing_so :
58- print (f" { p .relative_to (build_dir )} " )
65+ print (f" { p .relative_to (abi_dir )} " )
5966
6067 return len (found_failures ) or len (missing_so )
6168
0 commit comments