# HG changeset patch
# User Sylvain Thénault <sylvain.thenault@logilab.fr>
# Date 1272034597 -7200
#      Fri Apr 23 16:56:37 2010 +0200
# Branch stable
# Node ID e691ed317dda75ca94f04de7e90ae1bd18a01f55
# Parent  69db5f062634d02963713c7bb4d6411cde9fe68a
packaging fixes

diff --git a/__pkginfo__.py b/__pkginfo__.py
--- a/__pkginfo__.py
+++ b/__pkginfo__.py
@@ -14,9 +14,8 @@
 web = 'http://www.cubicweb.org/project/%s' % distname
 
 description = "commenting system for the CubicWeb framework"
-
+short_desc = description # XXX cw < 3.8 bw compat
 
-__depends__ = {'cubicweb': '>= 3.6.0'}
 classifiers = [
            'Environment :: Web Environment',
            'Framework :: CubicWeb',
@@ -24,24 +23,27 @@
            'Programming Language :: JavaScript',
 ]
 
+__depends__ = {'cubicweb': '>= 3.6.0'}
 
-from os import listdir
-from os.path import join
+# package ###
 
-CUBES_DIR = join('share', 'cubicweb', 'cubes')
+from os import listdir as _listdir
+from os.path import join, isdir, exists
+from glob import glob
+
+THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname)
 
-try:
-    data_files = [
-        [join(CUBES_DIR, 'comment'),
-         [fname for fname in listdir('.')
-          if fname.endswith('.py') and fname != 'setup.py']],
-        [join(CUBES_DIR, 'comment', 'data'),
-         [join('data', fname) for fname in listdir('data')]],
-        [join(CUBES_DIR, 'comment', 'i18n'),
-         [join('i18n', fname) for fname in listdir('i18n')]],
-        [join(CUBES_DIR, 'comment', 'migration'),
-         [join('migration', fname) for fname in listdir('migration')]],
-        ]
-except OSError:
-    # we are in an installed directory
-    pass
+def listdir(dirpath):
+    return [join(dirpath, fname) for fname in _listdir(dirpath)
+            if fname[0] != '.' and not fname.endswith('.pyc')
+            and not fname.endswith('~')
+            and not isdir(join(dirpath, fname))]
+
+data_files = [
+    # common files
+    [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
+    ]
+# check for possible extended cube layout
+for dname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration'):
+    if isdir(dname):
+        data_files.append([join(THIS_CUBE_DIR, dname), listdir(dname)])