From 3792978be1adcd7398e0211d87965626fdbdb035 2015-08-11 20:20:11 From: Min RK Date: 2015-08-11 20:20:11 Subject: [PATCH] ensure `__name__ == __main__` in autogen scripts run from conf.py --- diff --git a/docs/source/conf.py b/docs/source/conf.py index 5843c68..f198d88 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -30,7 +30,10 @@ if ON_RTD: fname = 'autogen_{}.py'.format(name) fpath = os.path.abspath(os.path.join('..', fname)) with open(fpath) as f: - exec(compile(f.read(), fname, 'exec'), {'__file__': fpath}) + exec(compile(f.read(), fname, 'exec'), { + '__file__': fpath, + '__name__': '__main__', + }) # If your extensions are in another directory, add it here. If the directory # is relative to the documentation root, use os.path.abspath to make it