Add entrypoint to setup.py for vendserver
authorMark Tearle <[email protected]>
Sat, 7 Mar 2015 13:20:10 +0000 (21:20 +0800)
committerMark Tearle <[email protected]>
Sat, 7 Mar 2015 13:28:36 +0000 (21:28 +0800)
VendServer/VendServer.py
bin/init.d/vendserver
setup.py

index c16cff1..d079b4e 100755 (executable)
@@ -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())
index 438bbf7..6ae51ab 100755 (executable)
@@ -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=""
index 9611d59..a17fbdc 100755 (executable)
--- 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",

UCC git Repository :: git.ucc.asn.au