diff options
author | Justin Mayer <entroP@gmail.com> | 2019-06-17 15:13:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-17 15:13:59 +0200 |
commit | 577d18a7789a6f5817f05f0d93c554a38cca5208 (patch) | |
tree | 726d5d1401131062eaa806e19761cdb53bb7f13d | |
parent | 9fdcb901f3825eb602f47eeea476204d26c2d97b (diff) | |
parent | 4bae94834e5325fe0d90631641cd2bdaa98b2b55 (diff) | |
download | pelican-577d18a7789a6f5817f05f0d93c554a38cca5208.tar.gz |
Merge pull request #2582 from timgates42/feature/python_main_support
Support for python -m pelican
-rw-r--r-- | pelican/__main__.py | 10 | ||||
-rw-r--r-- | pelican/tests/test_pelican.py | 7 | ||||
-rwxr-xr-x | setup.py | 2 |
3 files changed, 18 insertions, 1 deletions
diff --git a/pelican/__main__.py b/pelican/__main__.py new file mode 100644 index 00000000..141823fc --- /dev/null +++ b/pelican/__main__.py @@ -0,0 +1,10 @@ +""" +python -m pelican module entry point to run via python -m +""" +from __future__ import absolute_import + +from . import main + + +if __name__ == '__main__': + main() diff --git a/pelican/tests/test_pelican.py b/pelican/tests/test_pelican.py index e93c1223..502a45ac 100644 --- a/pelican/tests/test_pelican.py +++ b/pelican/tests/test_pelican.py @@ -263,3 +263,10 @@ class TestPelican(LoggedTestCase): count=1, msg="Could not process .*parse_error.rst", level=logging.ERROR) + + def test_module_load(self): + """Test loading via python -m pelican --help displays the help""" + output = subprocess.check_output([ + sys.executable, '-m', 'pelican', '--help' + ]).decode('ascii', 'replace') + assert 'usage:' in output @@ -12,7 +12,7 @@ requires = ['feedgenerator >= 1.9', 'jinja2 >= 2.7', 'pygments', 'docutils', entry_points = { 'console_scripts': [ - 'pelican = pelican:main', + 'pelican = pelican.__main__:main', 'pelican-import = pelican.tools.pelican_import:main', 'pelican-quickstart = pelican.tools.pelican_quickstart:main', 'pelican-themes = pelican.tools.pelican_themes:main' |