Ticket #240 (assigned enhancement)

Opened 7 months ago

Last modified 3 months ago

use setuptools (optionally) to make console_scripts

Reported by: zooko Assigned to: zooko (accepted)
Priority: major Milestone: undecided
Component: other Version: 0.7.6
Keywords: Cc: dustin

Description

Thu Apr 17 14:02:59 MDT 2008  zooko@zooko.com
  * setup: use the console_scripts feature of setuptools for buildbot, darcs_buildbot, and buildbot_service
  Also use the find_packages() feature of setuptools instead of an explicit list of packages in setup.py.  Also make contrib and contrib/windows be packages (by adding __init__.py files to them) so that they can be imported at run-time by the console scripts.
diff -rN -u old-trunk/contrib/darcs_buildbot.py new-trunk/contrib/darcs_buildbot.py
--- old-trunk/contrib/darcs_buildbot.py	2008-04-17 14:04:21.000000000 -0600
+++ new-trunk/contrib/darcs_buildbot.py	2008-04-17 14:04:21.000000000 -0600
@@ -159,6 +159,9 @@
         f.write(lastchange)
         f.close()
 
-if __name__ == '__main__':
+def main():
     MASTER = sys.argv[1]
     sendChanges(MASTER)
+
+if __name__ == '__main__':
+    main()
diff -rN -u old-trunk/setup.py new-trunk/setup.py
--- old-trunk/setup.py	2008-04-17 14:04:21.000000000 -0600
+++ new-trunk/setup.py	2008-04-17 14:04:21.000000000 -0600
@@ -1,7 +1,6 @@
 #! /usr/bin/env python
 
 import sys, os, re
-from distutils.core import setup
 from buildbot import version
 
 # Path: twisted!cvstoys!buildbot
@@ -32,11 +31,6 @@
 improve.
 """
 
-scripts = ["bin/buildbot"]
-if sys.platform == "win32":
-    scripts.append("contrib/windows/buildbot.bat")
-    scripts.append("contrib/windows/buildbot_service.py")
-
 testmsgs = []
 for f in os.listdir("buildbot/test/mail"):
     if f.endswith("~"):
@@ -64,16 +58,6 @@
         'Topic :: Software Development :: Testing',
         ],
 
-    'packages': ["buildbot",
-              "buildbot.status", "buildbot.status.web",
-              "buildbot.changes",
-              "buildbot.steps",
-              "buildbot.process",
-              "buildbot.clients",
-              "buildbot.slave",
-              "buildbot.scripts",
-              "buildbot.test",
-              ],
     'data_files': [("buildbot", ["buildbot/buildbot.png"]),
                 ("buildbot/clients", ["buildbot/clients/debug.glade"]),
                 ("buildbot/status/web",
@@ -85,7 +69,6 @@
                 ("buildbot/test/mail", testmsgs),
                 ("buildbot/test/subdir", ["buildbot/test/subdir/emit.py"]),
                 ],
-    'scripts ':  scripts,
     'cmdclass': {'install_data': install_data_twisted},
     }
 
@@ -94,9 +77,32 @@
     # to the setup args.
     import setuptools
 except ImportError:
-    pass
+    from distutils.core import setup
+    setup_args['scripts'] = ["bin/buildbot"]
+    if sys.platform == "win32":
+        setup_args['scripts'].append("contrib/windows/buildbot.bat")
+        setup_args['scripts'].append("contrib/windows/buildbot_service.py")
+    setup_args['packages'] = ["buildbot",
+              "buildbot.status", "buildbot.status.web",
+              "buildbot.changes",
+              "buildbot.steps",
+              "buildbot.process",
+              "buildbot.clients",
+              "buildbot.slave",
+              "buildbot.scripts",
+              "buildbot.test",
+              ],
 else:
+    from setuptools import find_packages, setup
     setup_args['install_requires'] = ['twisted >= 2.4.0']
+    setup_args['entry_points'] = {
+        'console_scripts': [
+            'buildbot = buildbot.scripts.runner:run',
+            'buildbot_service = contrib.windows.buildbot_service:HandleCommandLine',
+            'darcs_buildbot = contrib.darcs_buildbot:main'
+            ]
+        }
+    setup_args['packages'] = find_packages()
 
 setup(**setup_args)
 

Change History

04/17/08 13:29:18 changed by zooko

  • status changed from new to closed.
  • resolution set to duplicate.

Oops -- I clicked twice.

04/17/08 13:30:27 changed by zooko

  • status changed from closed to reopened.
  • resolution deleted.

Wait, no I didn't, this is a different patch than the one in #239.

08/26/08 16:09:14 changed by zooko

  • owner set to zooko.
  • status changed from reopened to new.

08/26/08 16:10:09 changed by zooko

  • status changed from new to assigned.

08/26/08 19:29:37 changed by dustin

  • cc set to dustin.

shoud I commit this?

08/27/08 06:17:16 changed by zooko

No, Brian might not want this one. I can commit it myself when/if the time comes. Brian's concern is that he doesn't want the console scripts feature of setuptools to get in the way of /usr/bin/buildbot in Debian packages.

Also, I thought that Brian already committed some patch or other from me that was related to this topic, so I will look into revision control history, too.