From 2975998e41cc3ce22d91f9f3d695e99912624121 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 10 Sep 2019 19:44:53 +0200 Subject: [PATCH] m.sphinx: dirty hack to make this file directly runnable. Because having to do python -m m.sphinx somefile.inv is too unintuitive to remember. --- plugins/m/sphinx.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/m/sphinx.py b/plugins/m/sphinx.py index f094ac2e..61d83064 100755 --- a/plugins/m/sphinx.py +++ b/plugins/m/sphinx.py @@ -24,11 +24,19 @@ # DEALINGS IN THE SOFTWARE. # +import os +import sys + +# So it's possible to do `./plugins/m/sphinx.py somefile.inv` without it all +# blowing up on the earliest `import math` as there's a math.py file in this +# directory. Alternatively, doing `python -m m.sphinx` would work too, but who +# would remember to do that. +if __name__ == '__main__': # pragma: no cover + sys.path.remove(os.path.realpath(os.path.dirname(__file__))) + import argparse import logging -import os import re -import sys from types import SimpleNamespace as Empty from typing import Dict, List, Optional from urllib.parse import urljoin -- 2.30.2