Entrypoints for commands

Use entrypoints for keystone-all and keystone-manage.

This makes keystone consistent with other projects that
already use entry points, e.g., nova.

Change-Id: Ib8d1a30d9b31d515dd5256896e24ae7b327fff6e
This commit is contained in:
Brant Knudson 2015-03-18 20:25:49 -05:00
parent 016dcae5d8
commit a549b74ebf
4 changed files with 16 additions and 9 deletions

0
keystone/cmd/__init__.py Normal file
View File

9
bin/keystone-all → keystone/cmd/all.py Executable file → Normal file
View File

@ -18,9 +18,11 @@ import os
import sys import sys
# If ../keystone/__init__.py exists, add ../ to Python search path, so that # If ../../keystone/__init__.py exists, add ../../ to Python search path, so
# it will override what happens to be installed in /usr/(local/)lib/python... # 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(__file__), possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__),
os.pardir,
os.pardir, os.pardir,
os.pardir)) os.pardir))
if os.path.exists(os.path.join(possible_topdir, if os.path.exists(os.path.join(possible_topdir,
@ -32,5 +34,6 @@ if os.path.exists(os.path.join(possible_topdir,
from keystone.server import eventlet as eventlet_server from keystone.server import eventlet as eventlet_server
if __name__ == '__main__': # entry point.
def main():
eventlet_server.run(possible_topdir) eventlet_server.run(possible_topdir)

9
bin/keystone-manage → keystone/cmd/manage.py Executable file → Normal file
View File

@ -17,9 +17,11 @@
import os import os
import sys import sys
# If ../keystone/__init__.py exists, add ../ to Python search path, so that # If ../../keystone/__init__.py exists, add ../../ to Python search path, so
# it will override what happens to be installed in /usr/(local/)lib/python... # 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]), possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir, os.pardir,
os.pardir)) os.pardir))
if os.path.exists(os.path.join(possible_topdir, if os.path.exists(os.path.join(possible_topdir,
@ -31,7 +33,8 @@ from keystone import cli
from keystone.common import environment from keystone.common import environment
if __name__ == '__main__': # entry point.
def main():
environment.use_stdlib() environment.use_stdlib()
dev_conf = os.path.join(possible_topdir, dev_conf = os.path.join(possible_topdir,

View File

@ -20,9 +20,6 @@ classifier =
[files] [files]
packages = packages =
keystone keystone
scripts =
bin/keystone-all
bin/keystone-manage
[global] [global]
setup-hooks = setup-hooks =
@ -63,6 +60,10 @@ warnerrors = True
#autodoc_tree_root = ./keystone #autodoc_tree_root = ./keystone
[entry_points] [entry_points]
console_scripts =
keystone-all = keystone.cmd.all:main
keystone-manage = keystone.cmd.manage:main
oslo.config.opts = oslo.config.opts =
keystone = keystone.common.config:list_opts keystone = keystone.common.config:list_opts
keystone.notifications = keystone.notifications:list_opts keystone.notifications = keystone.notifications:list_opts