[pkg] Make twisted recommended only
authorChristophe de Vienne <christophe@unlish.com>
Thu, 27 Nov 2014 13:40:37 +0100
changeset 10109 479190f019cc
parent 10108 129af90b2364
child 10110 f601d2fdeff7
[pkg] Make twisted recommended only It's not necessary when using wsgi or pyramid. Closes #4639508
__pkginfo__.py
cwctl.py
--- a/__pkginfo__.py	Thu Nov 27 12:11:29 2014 +0100
+++ b/__pkginfo__.py	Thu Nov 27 13:40:37 2014 +0100
@@ -46,7 +46,6 @@
     #gettext                    # for xgettext, msgcat, etc...
     # web dependencies
     'lxml': '',
-    'Twisted': '',
     # XXX graphviz
     # server dependencies
     'logilab-database': '>= 1.12.1',
@@ -63,6 +62,7 @@
     'vobject': '>= 0.6.0',      # for ical view
     'rdflib': None,             #
     'pyzmq': None,
+    'Twisted': '',
     #'Products.FCKeditor':'',
     #'SimpleTAL':'>= 4.1.6',
     }
--- a/cwctl.py	Thu Nov 27 12:11:29 2014 +0100
+++ b/cwctl.py	Thu Nov 27 13:40:37 2014 +0100
@@ -524,6 +524,15 @@
 
     def start_instance(self, appid):
         """start the instance's server"""
+        try:
+            import twisted  # noqa
+        except ImportError:
+            msg = (
+                "Twisted is required by the 'start' command\n"
+                "Either install it, or use one of the alternative commands:\n"
+                "- '{ctl} wsgi {appid}'\n"
+                "- '{ctl} pyramid {appid}' (requires the pyramid cube)\n")
+            raise ExecutionError(msg.format(ctl='cubicweb-ctl', appid=appid))
         config = cwcfg.config_for(appid, debugmode=self['debug'])
         init_cmdline_log_threshold(config, self['loglevel'])
         if self['profile']: