Skip to content

Commit 4a3867d

Browse files
committed
show_help: only parse specific trees for help files
Instead of only snipping known "bad" directories to traverse (e.g., "3rd-party" and ".git"), also limit the search for text help files to just known "good" top-level directories: opal, ompi, oshmem. This prevents accidentally traversing into VPATH build directories, for example, and finding PMIx and/or PRTE help files. Signed-off-by: Jeff Squyres <[email protected]>
1 parent fcdc735 commit 4a3867d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

opal/util/convert-help-files-to-c-code.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,25 @@ def find_help_files(root, verbose=False):
1717
# some directories (e.g., 3rd-party)
1818
help_files = []
1919
skip_dirs = ['.git', '3rd-party']
20+
include_top_dirs = ['ompi', 'opal', 'oshmem']
2021
for root_dir, dirs, files in os.walk(root):
22+
# If we're in the top-level directory, only traverse into
23+
# specific subdirectories. Look for a bunch of sentinel files
24+
# to know that we're in the top-level directory.
25+
if 'HACKING.md' in files and 'LICENSE' in files and \
26+
'README.md' in files and 'VERSION' in files and \
27+
'.readthedocs.yaml' in files and '.mailmap' in files:
28+
for dir in list(dirs):
29+
if dir not in include_top_dirs:
30+
print(f"Skipping top-level dir: {dir}")
31+
dirs.remove(dir)
32+
33+
# We probably won't run into these directories anywhere except
34+
# in the top-level directory, but we might as well make sure
35+
# to skip them everywhere, too.
2136
for sd in skip_dirs:
2237
if sd in dirs:
38+
print(f"Skipping additional dir: {root_dir}/{sd}")
2339
dirs.remove(sd)
2440

2541
for file in files:

0 commit comments

Comments
 (0)