From: Mark Tearle Date: Sat, 7 Mar 2015 13:20:10 +0000 (+0800) Subject: Add entrypoint to setup.py for vendserver X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=fc54224064166688cff70891381774884d5c7729;p=uccvend-vendserver.git Add entrypoint to setup.py for vendserver --- 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",