Skip to content

Commit deb3f39

Browse files
committed
fix script
1 parent 5eb64f6 commit deb3f39

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

.github/scripts/compare_vendordeps.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,25 @@
22
from pathlib import Path
33

44
def list_json_filenames(folder):
5-
return set(p.name for p in Path(folder).glob("*.json"))
5+
p = Path(folder)
6+
if not p.exists():
7+
print(f"Warning: Folder {folder} does not exist.")
8+
return set()
9+
return set(f.name for f in p.glob("*.json"))
610

711
def main(project_folder, library_folder):
812
project_files = list_json_filenames(project_folder)
913
library_files = list_json_filenames(library_folder)
1014

11-
missing_in_lib = project_files - library_files
12-
missing_in_project = library_files - project_files
15+
missing_from_project = library_files - project_files
1316

14-
if missing_in_lib or missing_in_project:
15-
if missing_in_lib:
16-
print(f"Files in project vendordeps but missing in library: {sorted(missing_in_lib)}")
17-
if missing_in_project:
18-
print(f"Files in library vendordeps but missing in project: {sorted(missing_in_project)}")
19-
sys.exit(1) # Fail CI
17+
if missing_from_project:
18+
print(f"ERROR: The following vendordep files exist in the library but are missing from the project:")
19+
for f in sorted(missing_from_project):
20+
print(f" - {f}")
21+
sys.exit(1)
2022
else:
21-
print("Vendor dependency files match exactly!")
23+
print("Success: All library vendordep files exist in the project.")
2224

2325
if __name__ == "__main__":
2426
if len(sys.argv) != 3:

0 commit comments

Comments
 (0)