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

View File

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