From 97d2e4d7849be5a2ed1caae896c80d64592ea0f1 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Fri, 4 May 2012 09:49:18 +0200 Subject: [PATCH] Use console_scripts instead of scripts. Unfortunately zc.buildout does not support distribute/setuptools script option (see https://bugs.launchpad.net/zc.buildout/+bug/422724), but it does support console_scripts. This also makes the scripts importable, allowing for unittest and code reuse. --- rq/scripts/__init__.py | 0 bin/rqgenload => rq/scripts/rqgenload.py | 1 + bin/rqinfo => rq/scripts/rqingo.py | 3 --- bin/rqworker => rq/scripts/rqworker.py | 4 ---- setup.py | 6 +++++- 5 files changed, 6 insertions(+), 8 deletions(-) create mode 100644 rq/scripts/__init__.py rename bin/rqgenload => rq/scripts/rqgenload.py (99%) rename bin/rqinfo => rq/scripts/rqingo.py (99%) rename bin/rqworker => rq/scripts/rqworker.py (98%) diff --git a/rq/scripts/__init__.py b/rq/scripts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/bin/rqgenload b/rq/scripts/rqgenload.py similarity index 99% rename from bin/rqgenload rename to rq/scripts/rqgenload.py index a6e4cfd..3a10b7e 100755 --- a/bin/rqgenload +++ b/rq/scripts/rqgenload.py @@ -60,3 +60,4 @@ def main(): if __name__ == '__main__': main() + diff --git a/bin/rqinfo b/rq/scripts/rqingo.py similarity index 99% rename from bin/rqinfo rename to rq/scripts/rqingo.py index 851b4ec..c695d95 100755 --- a/bin/rqinfo +++ b/rq/scripts/rqingo.py @@ -177,6 +177,3 @@ def main(): interval(args.interval, func, args) except ConnectionError as e: print(e) - -if __name__ == '__main__': - main() diff --git a/bin/rqworker b/rq/scripts/rqworker.py similarity index 98% rename from bin/rqworker rename to rq/scripts/rqworker.py index e6a72e2..12ceb05 100755 --- a/bin/rqworker +++ b/rq/scripts/rqworker.py @@ -71,7 +71,3 @@ def main(): w.work(burst=args.burst) except ConnectionError as e: print(e) - - -if __name__ == '__main__': - main() diff --git a/setup.py b/setup.py index 97a3189..3adac2e 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,11 @@ setup( zip_safe=False, platforms='any', install_requires=get_dependencies(), - scripts=['bin/rqinfo', 'bin/rqworker'], + entry_points='''\ + [console_scripts] + rqworker = rq.scripts.rqworker:main + rqinfo = rq.scripts.rqinfo:main + ''', classifiers=[ # As from http://pypi.python.org/pypi?%3Aaction=list_classifiers #'Development Status :: 1 - Planning',