[pkg] Declare extras (optional) dependencies
authorDenis Laxalde <denis.laxalde@logilab.fr>
Mon, 26 Sep 2016 18:20:53 +0200
changeset 11685 6c263b8091d3
parent 11682 299640088c23
child 11686 41d4f0f3855c
[pkg] Declare extras (optional) dependencies This is primary to extract "pyramid" dependencies out of install_requires as they are actually optional. Along the way, resurrect all things in __pkginfo__.__recommends__ which were not used at all and convert them into extra_requires. It appears that __depends__ and __recommends__ in __pkginfo__.py are not useful so drop them and inline dependencies as install_requires/extra_requires in setup function call. For pyramid tests to continue working, add respective dependencies to test-misc.txt requirements file.
cubicweb/__pkginfo__.py
requirements/test-misc.txt
setup.py
--- a/cubicweb/__pkginfo__.py	Mon Sep 26 16:53:33 2016 +0200
+++ b/cubicweb/__pkginfo__.py	Mon Sep 26 18:20:53 2016 +0200
@@ -43,42 +43,6 @@
     'Programming Language :: JavaScript',
 ]
 
-__depends__ = {
-    'six': '>= 1.4.0',
-    'logilab-common': '>= 1.2.2',
-    'logilab-mtconverter': '>= 0.8.0',
-    'rql': '>= 0.34.0',
-    'yams': '>= 0.44.0',
-    #gettext                    # for xgettext, msgcat, etc...
-    # web dependencies
-    'lxml': '',
-    # XXX graphviz
-    # server dependencies
-    'logilab-database': '>= 1.15.0',
-    'passlib': '',
-    'pytz': '',
-    'Markdown': '',
-    'unittest2': '>= 0.7.0',
-    # pyramid dependencies
-    'pyramid': '>= 1.5.0',
-    'waitress': '>= 0.8.9',
-    'wsgicors': '>= 0.3',
-    'pyramid_multiauth': '',
-    }
-
-__recommends__ = {
-    'docutils': '>= 0.6',
-    'Pillow': '',               # for captcha
-    'pycrypto': '',             # for crypto extensions
-    'fyzz': '>= 0.1.0',         # for sparql
-    'vobject': '>= 0.6.0',      # for ical view
-    'rdflib': None,             #
-    'pyzmq': None,
-    'Twisted': '< 16.0.0',
-    #'Products.FCKeditor':'',
-    #'SimpleTAL':'>= 4.1.6',
-}
-
 scripts = [s for s in glob.glob(join('bin', 'cubicweb-*'))
            if not s.endswith('.bat')]
 include_dirs = [join('test', 'data'),
--- a/requirements/test-misc.txt	Mon Sep 26 16:53:33 2016 +0200
+++ b/requirements/test-misc.txt	Mon Sep 26 18:20:53 2016 +0200
@@ -20,5 +20,11 @@
 ## cubicweb/hooks/test
 psycopg2
 
+## cubicweb/pyramid/test
+pyramid >= 1.5.0
+waitress >= 0.8.9
+wsgicors >= 0.3
+pyramid_multiauth
+
 ## cubicweb/sobject/test
 cubicweb-comment
--- a/setup.py	Mon Sep 26 16:53:33 2016 +0200
+++ b/setup.py	Mon Sep 26 18:20:53 2016 +0200
@@ -50,12 +50,6 @@
     long_description = f.read()
 
 # import optional features
-requires = {}
-for entry in ("__depends__",): # "__recommends__"):
-    requires.update(__pkginfo__.get(entry, {}))
-install_requires = [("%s %s" % (d, v and v or "")).strip()
-                   for d, v in requires.items()]
-
 distname = __pkginfo__['distname']
 scripts = __pkginfo__['scripts']
 include_dirs = __pkginfo__['include_dirs']
@@ -208,7 +202,51 @@
     package_data=package_data,
     scripts=ensure_scripts(scripts),
     data_files=data_files,
-    install_requires=install_requires,
+    install_requires=[
+        'six >= 1.4.0',
+        'logilab-common >= 1.2.2',
+        'logilab-mtconverter >= 0.8.0',
+        'rql >= 0.34.0',
+        'yams >= 0.44.0',
+        'lxml',
+        'logilab-database >= 1.15.0',
+        'passlib',
+        'pytz',
+        'Markdown',
+        'unittest2 >= 0.7.0',
+    ],
+    extra_requires={
+        'captcha': [
+            'Pillow',
+        ],
+        'crypto': [
+            'pycrypto',
+        ],
+        'etwist': [
+            'Twisted < 16.0.0',
+        ],
+        'ext': [
+            'docutils >= 0.6',
+        ],
+        'ical': [
+            'vobject >= 0.6.0',
+        ],
+        'pyramid': [
+            'pyramid >= 1.5.0',
+            'waitress >= 0.8.9',
+            'wsgicors >= 0.3',
+            'pyramid_multiauth',
+        ],
+        'rdf': [
+            'rdflib',
+        ],
+        'sparql': [
+            'fyzz >= 0.1.0',
+        ],
+        'zmq': [
+            'pyzmq',
+        ],
+    },
     cmdclass={'install_lib': MyInstallLib,
               'install_data': MyInstallData},
     zip_safe=False,