1
0
mirror of https://github.com/gsi-upm/senpy synced 2024-11-22 00:02:28 +00:00

Added console script

This commit is contained in:
J. Fernando Sánchez 2015-10-08 18:20:16 +02:00
parent 50e8e2730b
commit 74b0cf868e
2 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,7 @@ import argparse
patch_all(thread=False) patch_all(thread=False)
if __name__ == '__main__': def main():
parser = argparse.ArgumentParser(description='Run a Senpy server') parser = argparse.ArgumentParser(description='Run a Senpy server')
parser.add_argument('--level', parser.add_argument('--level',
"-l", "-l",
@ -47,7 +47,7 @@ if __name__ == '__main__':
parser.add_argument('--default-plugins', parser.add_argument('--default-plugins',
action='store_true', action='store_true',
default=False, default=False,
help='Run the application in debug mode') help='Load the default plugins')
parser.add_argument('--host', parser.add_argument('--host',
type=str, type=str,
default="127.0.0.1", default="127.0.0.1",
@ -68,7 +68,6 @@ if __name__ == '__main__':
app.debug = args.debug app.debug = args.debug
sp = Senpy(app, args.plugins_folder, default_plugins=args.default_plugins) sp = Senpy(app, args.plugins_folder, default_plugins=args.default_plugins)
sp.activate_all() sp.activate_all()
import logging
http_server = WSGIServer((args.host, args.port), app) http_server = WSGIServer((args.host, args.port), app)
try: try:
print("Server running on port %s:%d. Ctrl+C to quit" % (args.host, print("Server running on port %s:%d. Ctrl+C to quit" % (args.host,
@ -77,3 +76,6 @@ if __name__ == '__main__':
except KeyboardInterrupt: except KeyboardInterrupt:
http_server.stop() http_server.stop()
print("Bye!") print("Bye!")
if __name__ == '__main__':
main()

View File

@ -36,4 +36,9 @@ extendable, so new algorithms and sources can be used.
tests_require=test_reqs, tests_require=test_reqs,
test_suite="nose.collector", test_suite="nose.collector",
include_package_data=True, include_package_data=True,
entry_points={
'console_scripts': [
'senpy = senpy.__main__:main'
]
}
) )