From fc54224064166688cff70891381774884d5c7729 Mon Sep 17 00:00:00 2001 From: Mark Tearle Date: Sat, 7 Mar 2015 21:20:10 +0800 Subject: [PATCH] Add entrypoint to setup.py for vendserver --- VendServer/VendServer.py | 5 ++++- bin/init.d/vendserver | 2 +- setup.py | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/VendServer/VendServer.py b/VendServer/VendServer.py index c16cff1..d079b4e 100755 --- a/VendServer/VendServer.py +++ b/VendServer/VendServer.py @@ -1186,7 +1186,8 @@ def do_vend_server(options, config_opts): logging.info("Trying again in 5 seconds.") sleep(5) -if __name__ == '__main__': + +def main(argv=None): options, config_opts = set_stuff_up() while True: try: @@ -1216,3 +1217,5 @@ if __name__ == '__main__': sleep(10) logging.warning("Trying again anyway (might not help, but hey...)") +if __name__ == '__main__': + sys.exit(main()) diff --git a/bin/init.d/vendserver b/bin/init.d/vendserver index 438bbf7..6ae51ab 100755 --- a/bin/init.d/vendserver +++ b/bin/init.d/vendserver @@ -14,7 +14,7 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games DESC="VendServer" NAME=vendserver -DAEMON="/usr/local/uccvend-vendserver/VendServer/VendServer.py" +DAEMON="/usr/local/uccvend-vendserver/vendserver" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME DAEMON_ARGS="" diff --git a/setup.py b/setup.py index 9611d59..a17fbdc 100755 --- a/setup.py +++ b/setup.py @@ -40,6 +40,11 @@ setup( ] ) ], + entry_points={ + "console_scripts": [ + "vendserver = VendServer.VendServer:main" + ] + }, include_package_data=True, install_requires=requirements, license="BSD", -- 2.20.1