From 7df9e7ffe15fe985832e7da6ce6c72a7acaf2af7 Mon Sep 17 00:00:00 2001 From: Monty Taylor Date: Sun, 25 Nov 2012 12:12:28 -0800 Subject: [PATCH] Use entrypoints for zuul-server. If we put the code for zuul-server into the zuul module, then autodoc will pick it up for documentation. Change-Id: Idf2db82f706243c6e69984170b4783f1eece2237 Reviewed-on: https://review.openstack.org/16850 Reviewed-by: Clark Boylan Reviewed-by: James E. Blair Approved: James E. Blair Tested-by: Jenkins --- setup.py | 8 ++++++-- tox.ini | 2 +- zuul/cmd/__init__.py | 0 zuul-server => zuul/cmd/server.py | 8 ++++---- 4 files changed, 11 insertions(+), 7 deletions(-) create mode 100644 zuul/cmd/__init__.py rename zuul-server => zuul/cmd/server.py (96%) diff --git a/setup.py b/setup.py index 46e2659230..6ad7ebe7d3 100644 --- a/setup.py +++ b/setup.py @@ -35,7 +35,6 @@ setuptools.setup( cmdclass=setup.get_cmdclass(), install_requires=requires, dependency_links=depend_links, - scripts=['zuul-server'], zip_safe=False, classifiers=[ 'Environment :: Console', @@ -44,5 +43,10 @@ setuptools.setup( 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python' - ] + ], + entry_points={ + 'console_scripts': [ + 'zuul-server=zuul.cmd.server:main', + ], + } ) diff --git a/tox.ini b/tox.ini index 334cc94ec1..198c01c1a3 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ setenv = NOSE_WITH_COVERAGE=1 [testenv:pyflakes] deps = pyflakes -commands = pyflakes zuul zuul-server setup.py +commands = pyflakes zuul setup.py [testenv:venv] commands = {posargs} diff --git a/zuul/cmd/__init__.py b/zuul/cmd/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/zuul-server b/zuul/cmd/server.py similarity index 96% rename from zuul-server rename to zuul/cmd/server.py index d57c564071..4f77610c44 100755 --- a/zuul-server +++ b/zuul/cmd/server.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # Copyright 2012 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -19,7 +18,7 @@ import daemon try: import daemon.pidlockfile as pid_file_module - pid_file_module # workaround for pyflakes issue #13 + pid_file_module # workaround for pyflakes issue #13 except: # as of python-daemon 1.6 it doesn't bundle pidlockfile anymore # instead it depends on lockfile-0.9.1 which uses pidfile. @@ -105,9 +104,10 @@ class Server(object): signal.pause() except KeyboardInterrupt: print "Ctrl + C: asking scheduler to exit nicely...\n" - self.exit_handler( signal.SIGINT, None ) + self.exit_handler(signal.SIGINT, None) -if __name__ == '__main__': + +def main(): server = Server() server.parse_arguments() server.read_config()