diff options
author | Matthew Peveler <matt.peveler@gmail.com> | 2021-12-18 10:50:46 -0500 |
---|---|---|
committer | Matthew Peveler <matt.peveler@gmail.com> | 2021-12-18 11:09:10 -0500 |
commit | ace8de363b031f9fa31657bff9017c2afd60938b (patch) | |
tree | 6f74604f5094cc0c9622a58fb9d18911fd8f9999 | |
parent | 46a58b19900ad69ba6c676a28ce309ca8233d0c8 (diff) | |
download | asciidoc-py3-ace8de363b031f9fa31657bff9017c2afd60938b.tar.gz |
Fix RuntimeWarning when using the -m flag
Signed-off-by: Matthew Peveler <matt.peveler@gmail.com>
-rw-r--r-- | asciidoc/__init__.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/asciidoc/__init__.py b/asciidoc/__init__.py index 15f6aa7..884b29e 100644 --- a/asciidoc/__init__.py +++ b/asciidoc/__init__.py @@ -1,7 +1,13 @@ """asciidoc module""" -from .api import AsciiDocAPI -from .asciidoc import execute, cli +import sys from .__metadata__ import VERSION, __version__ -__all__ = ['AsciiDocAPI', 'execute', 'cli', 'VERSION', '__version__'] +__all__ = ['VERSION', '__version__'] + +# If running as a script, we avoid these imports to avoid a circular +# RuntimeWarning, which is fine as we don't use them in that case. +if "-m" not in sys.argv: + from .api import AsciiDocAPI + from .asciidoc import execute, cli + __all__ += ['AsciiDocAPI', 'execute', 'cli'] |