Skip to content

Commit

Permalink
Don't ignore failure to create directory
Browse files Browse the repository at this point in the history
Make a "best effort" attempt to create the output
directory tree for the dummy ini files, but don't
ignore it if we can't - just fall back to providing
the user with a runtime error when the "show help"
file cannot be found.

Signed-off-by: Ralph Castain <rhc@pmix.org>
(cherry picked from commit 5eb7e7b)
  • Loading branch information
rhc54 committed Sep 15, 2023
1 parent 7ea28ae commit d45206a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/docs/show-help-files/build-dummy-ini-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@

# Trivial script to scrape section names from source .rst files and
# generate dummy show_help-style text files. We only use this script
# a) if the show_help files are not availabale (i.e., in a git clone),
# a) if the show_help files are not available (i.e., in a git clone),
# and b) if Sphinx is not available.
#
# We generate these show_help files (as opposed to generating a run
# time error when the show_help file is unavailable) just so that it's
# 100% obvious that you're not getting proper help files because you
# did not have Sphinx available.

# Intentially use a minimal set of Python modules (to decrease any
# Intentionally use a minimal set of Python modules (to decrease any
# needed dependencies).

import re
Expand Down Expand Up @@ -68,7 +68,9 @@
try:
os.makedirs(full_outdir, exists_ok=True)
except Exception:
pass
# cannot create the directory, so just leave it alone
# we did our best, they'll just get a runtime error
return

# Write the output file
with open(outfile, 'w') as fp:
Expand Down

0 comments on commit d45206a

Please sign in to comment.