packaging fix: the views subpackage was missing. Backport new style data_files construction to avoid such error in the future
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 12 Feb 2010 09:54:53 +0100
changeset 164 1663cbd2a6d9
parent 161 4e7ee3b4a15b
child 165 44a35ca8eda2
packaging fix: the views subpackage was missing. Backport new style data_files construction to avoid such error in the future
__pkginfo__.py
--- a/__pkginfo__.py	Mon Feb 08 21:50:14 2010 +0100
+++ b/__pkginfo__.py	Fri Feb 12 09:54:53 2010 +0100
@@ -8,8 +8,6 @@
 version = '.'.join(str(num) for num in numversion)
 
 license = 'LGPL'
-copyright = '''Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
-http://www.logilab.fr/ -- mailto:contact@logilab.fr'''
 
 author = "Logilab"
 author_email = "contact@logilab.fr"
@@ -74,22 +72,23 @@
 
 # package ###
 
-from os import listdir
-from os.path import join
+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)
 
-CUBES_DIR = join('share', 'cubicweb', 'cubes')
-try:
-    data_files = [
-        [join(CUBES_DIR, 'blog'),
-         [fname for fname in listdir('.')
-          if fname.endswith('.py') and fname != 'setup.py']],
-        [join(CUBES_DIR, 'blog', 'data'),
-         [join('data', fname) for fname in listdir('data')]],
-        [join(CUBES_DIR, 'blog', 'i18n'),
-         [join('i18n', fname) for fname in listdir('i18n')]],
-        [join(CUBES_DIR, 'blog', '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)])