[pkginfo] when only __depends__ is specified, deduced __depends_cubes__ from it (same thing for recommends) ; fix ad skel pkginfo on the way
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 07 Apr 2010 09:45:15 +0200
changeset 5163 3079b8345915
parent 5162 6340ed9f8caf
child 5173 73760bbb66bd
[pkginfo] when only __depends__ is specified, deduced __depends_cubes__ from it (same thing for recommends) ; fix ad skel pkginfo on the way
cwconfig.py
skeleton/__pkginfo__.py.tmpl
--- a/cwconfig.py	Wed Apr 07 09:43:50 2010 +0200
+++ b/cwconfig.py	Wed Apr 07 09:45:15 2010 +0200
@@ -459,17 +459,27 @@
         """return cubicweb cubes used by the given cube"""
         pkginfo = cls.cube_pkginfo(cube)
         try:
+            # explicit __xxx_cubes__ attribute
             deps = getattr(pkginfo, key)
         except AttributeError:
-            if hasattr(pkginfo, oldkey):
-                warn('[3.6] %s is deprecated, use %s dict' % (oldkey, key),
-                     DeprecationWarning)
-                deps = getattr(pkginfo, oldkey)
+            # deduce cubes from generic __xxx__ attribute
+            try:
+                gendeps = getattr(pkginfo, key.replace('_cubes', ''))
+            except AttributeError:
+                # bw compat
+                if hasattr(pkginfo, oldkey):
+                    warn('[3.8] %s is deprecated, use %s dict' % (oldkey, key),
+                         DeprecationWarning)
+                    deps = getattr(pkginfo, oldkey)
+                else:
+                    deps = {}
             else:
-                deps = {}
+                deps = dict( (x[len('cubicweb-'):], v)
+                             for x, v in gendeps.iteritems()
+                             if x.startswith('cubicweb-'))
         if not isinstance(deps, dict):
             deps = dict((key, None) for key in deps)
-            warn('[3.6] cube %s should define %s as a dict' % (cube, key),
+            warn('[3.8] cube %s should define %s as a dict' % (cube, key),
                  DeprecationWarning)
         return deps
 
--- a/skeleton/__pkginfo__.py.tmpl	Wed Apr 07 09:43:50 2010 +0200
+++ b/skeleton/__pkginfo__.py.tmpl	Wed Apr 07 09:45:15 2010 +0200
@@ -40,10 +40,6 @@
 # Note: here, you'll need to add subdirectories if you want
 # them to be included in the debian package
 
-__depends__ = {'cubicweb': '>= 3.6.0'}
-__depends_cubes__ = dict( (x[len('cubicweb-):], v) for x, v in __depends__
-                          if x.startswith('cubicweb-'))
+__depends__ = {'cubicweb': '>= 3.8.0'}
 __recommends__ = {}
-__recommends_cubes__ = dict( (x[len('cubicweb-):], v) for x, v in __recommends__
-                             if x.startswith('cubicweb-'))