[pkg] make __pkginfo__ unsensitive to current working directory
authorDavid Douard <david.douard@logilab.fr>
Fri, 23 May 2014 11:00:46 +0200
changeset 1525 1e985a602687
parent 1524 e9922ca0b813
child 1526 6f670e3273be
[pkg] make __pkginfo__ unsensitive to current working directory
__pkginfo__.py
--- a/__pkginfo__.py	Thu May 22 23:26:01 2014 +0200
+++ b/__pkginfo__.py	Fri May 23 11:00:46 2014 +0200
@@ -34,7 +34,7 @@
 # packaging ###
 
 from os import listdir as _listdir
-from os.path import join, isdir
+from os.path import join, isdir, dirname
 from glob import glob
 
 THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname)
@@ -50,21 +50,22 @@
     [THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
     ]
 # check for possible extended cube layout
-for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration', 'wdoc'):
-    if isdir(dirname):
-        data_files.append([join(THIS_CUBE_DIR, dirname), listdir(dirname)])
+for subdir in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration', 'wdoc'):
+    if isdir(subdir):
+        data_files.append([join(THIS_CUBE_DIR, subdir), listdir(subdir)])
 # Note: here, you'll need to add subdirectories if you want
 # them to be included in the debian package
 
-if isdir('_narval'): # test REQUIRED (to be importable from everywhere)
+NARVALDIR = join(dirname(__file__), '_narval')
+if isdir(NARVALDIR): # test REQUIRED (to be importable from everywhere)
     data_files.append([join('share', 'narval', 'checkers'),
-                       listdir(join('_narval', 'checkers'))])
+                       listdir(join(NARVALDIR, 'checkers'))])
     data_files.append([join('share', 'narval', 'checkers', modname),
-                       listdir(join('_narval', 'checkers', modname))])
+                       listdir(join(NARVALDIR, 'checkers', modname))])
     data_files.append([join('share', 'narval', 'preprocessors'),
-                       listdir(join('_narval', 'preprocessors'))])
+                       listdir(join(NARVALDIR, 'preprocessors'))])
     data_files.append([join('share', 'narval', 'preprocessors', modname),
-                       listdir(join('_narval', 'preprocessors', modname))])
-if isdir(join('_narval', 'data')): # test REQUIRED (to be importable from everywhere)
+                       listdir(join(NARVALDIR, 'preprocessors', modname))])
+if isdir(join(NARVALDIR, 'data')): # test REQUIRED (to be importable from everywhere)
     data_files.append([join('share', 'narval', 'data'),
-                       listdir(join('_narval', 'data'))])
+                       listdir(join(NARVALDIR, 'data'))])