Allowances for getting sphinx docs set up.
[python_utils.git] / config.py
index bea701837c520ca86d584f9b48cead98ab06e838..599026c8f95ec4379c22261ed025c9f9a7b5e063 100644 (file)
--- a/config.py
+++ b/config.py
@@ -106,6 +106,11 @@ ARGS = argparse.ArgumentParser(
     formatter_class=OptionalRawFormatter,
     fromfile_prefix_chars="@",
     epilog=f'{PROGRAM_NAME} uses config.py ({__file__}) for global, cross-module configuration setup and parsing.',
+    # I don't fully understand why but when loaded by sphinx sometimes
+    # the same module is loaded many times causing any arguments it
+    # registers via module-level code to be redefined.  Work around
+    # this iff the program is 'sphinx-build'
+    conflict_handler='resolve' if PROGRAM_NAME == 'sphinx-build' else 'error',
 )
 
 # Keep track of if we've been called and prevent being called more