Switch to setuptools entry points

This commit is contained in:
Dmitry Tantsur 2014-10-09 17:14:46 +02:00
parent 74242c2776
commit eef833ce30
3 changed files with 13 additions and 14 deletions

View File

@ -1,3 +0,0 @@
#!/usr/bin/env python2
import ironic_discoverd.__main__

View File

@ -50,15 +50,17 @@ def periodic_update():
eventlet.greenthread.sleep(15)
if len(sys.argv) < 2:
sys.exit("Usage: %s config-file" % sys.argv[0])
def main():
if len(sys.argv) < 2:
sys.exit("Usage: %s config-file" % sys.argv[0])
discoverd.CONF.read(sys.argv[1])
debug = discoverd.CONF.getboolean('discoverd', 'debug')
discoverd.CONF.read(sys.argv[1])
debug = discoverd.CONF.getboolean('discoverd', 'debug')
logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)
discoverd.Firewall.init()
eventlet.greenthread.spawn_n(periodic_update)
logging.basicConfig(level=logging.DEBUG if debug else logging.INFO)
discoverd.Firewall.init()
eventlet.greenthread.spawn_n(periodic_update)
app.run(debug=debug, host=discoverd.CONF.get('discoverd', 'listen_address'),
port=discoverd.CONF.getint('discoverd', 'listen_port'))
app.run(debug=debug,
host=discoverd.CONF.get('discoverd', 'listen_address'),
port=discoverd.CONF.getint('discoverd', 'listen_port'))

View File

@ -8,8 +8,8 @@ setup(
author = "Dmitry Tantsur",
author_email = "dtansur@redhat.com",
url = "https://github.com/Divius/ironic-discoverd/",
packages=['ironic_discoverd'],
packages = ['ironic_discoverd'],
install_requires = ['Flask', 'python-ironicclient', 'eventlet',
'python-keystoneclient'],
scripts = ['bin/ironic-discoverd'],
entry_points = {'console_scripts': ["ironic-discoverd = ironic_discoverd.main:main"]},
)