From 19083c8c98cb38eb580279fabb60b4f168ef8196 Mon Sep 17 00:00:00 2001 From: Ethan Lynn Date: Thu, 14 Jan 2016 16:07:45 +0800 Subject: [PATCH] Make senlin-engine a console script entry point Make senlin-engine a console script entry point, and delete senlin-engine from bin/ folder. Change-Id: If2ab488374ad5ad01f7f146e8b361e422abbf241 --- bin/senlin-engine => senlin/cmd/engine.py | 18 ++---------------- setup.cfg | 3 +-- tox.ini | 2 +- 3 files changed, 4 insertions(+), 19 deletions(-) rename bin/senlin-engine => senlin/cmd/engine.py (72%) mode change 100755 => 100644 diff --git a/bin/senlin-engine b/senlin/cmd/engine.py old mode 100755 new mode 100644 similarity index 72% rename from bin/senlin-engine rename to senlin/cmd/engine.py index 7129f4bba..9cfdbed03 --- a/bin/senlin-engine +++ b/senlin/cmd/engine.py @@ -15,21 +15,6 @@ """ Senlin Engine Server. """ - -import eventlet -eventlet.monkey_patch() - -import os -import sys - -# If ../senlin/__init__.py exists, add ../ to Python search path, so that -# it will override what happens to be installed in /usr/(local/)lib/python... -POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]), - os.pardir, - os.pardir)) -if os.path.exists(os.path.join(POSSIBLE_TOPDIR, 'senlin', '__init__.py')): - sys.path.insert(0, POSSIBLE_TOPDIR) - from oslo_config import cfg from oslo_i18n import _lazy from oslo_log import log as logging @@ -42,7 +27,8 @@ _lazy.enable_lazy() LOG = logging.getLogger('senlin.engine') -if __name__ == '__main__': + +def main(): logging.register_options(cfg.CONF) cfg.CONF(project='senlin', prog='senlin-engine') logging.setup(cfg.CONF, 'senlin-engine') diff --git a/setup.cfg b/setup.cfg index 5ef1371b1..dff67381b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -22,12 +22,11 @@ classifier = [files] packages = senlin -scripts = - bin/senlin-engine [entry_points] console_scripts = senlin-api = senlin.cmd.api:main + senlin-engine = senlin.cmd.engine:main senlin-manage = senlin.cmd.manage:main oslo.config.opts = diff --git a/tox.ini b/tox.ini index 54a6ee8e1..238d92a10 100644 --- a/tox.ini +++ b/tox.ini @@ -44,7 +44,7 @@ commands = oslo_debug_helper {posargs} [testenv:pep8] commands = - flake8 senlin bin/senlin-engine + flake8 senlin # Check that .po and .pot files are valid: bash -c "find senlin -type f -regex '.*\.pot?' -print0|xargs -0 -n 1 msgfmt --check-format -o /dev/null"