Skip to content

Commit 45ab0cc

Browse files
committed
BUG: Fix scenario where I have submodules but not attributes.
Failure uncovered by gh-pages submodule.
1 parent c1ff3ba commit 45ab0cc

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/check_python_h_first/get_submodule_paths.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,14 @@ def get_submodule_paths():
4040
os.path.join(root_directory, path) for path in submodule_paths
4141
]
4242
# vendored with a script rather than via gitmodules
43-
with open(os.path.join(root_directory, ".gitattributes"), "r") as attr_file:
44-
for line in attr_file:
45-
if "vendored" in line:
46-
pattern = line.split(" ", 1)[0]
47-
submodule_paths.extend(glob.glob(pattern))
43+
try:
44+
with open(os.path.join(root_directory, ".gitattributes"), "r") as attr_file:
45+
for line in attr_file:
46+
if "vendored" in line:
47+
pattern = line.split(" ", 1)[0]
48+
submodule_paths.extend(glob.glob(pattern))
49+
except FileNotFoundError:
50+
pass
4851

4952
return submodule_paths
5053

0 commit comments

Comments
 (0)