[pkg] fix jslint.js handling in __pkginfo__
authorDavid Douard <david.douard@logilab.fr>
Wed, 14 May 2014 22:11:38 +0200
changeset 1519 2a8d6cfd864b
parent 1518 fd0a087f6117
child 1520 0abe241164e2
[pkg] fix jslint.js handling in __pkginfo__ and install it in /usr/share/narval/data directly (instead of /usr/share/narval/data/apycot) for the sake of simplicity.
__pkginfo__.py
_narval/checkers/apycot/jslint.py
--- a/__pkginfo__.py	Wed May 14 16:05:06 2014 +0200
+++ b/__pkginfo__.py	Wed May 14 22:11:38 2014 +0200
@@ -56,7 +56,7 @@
 # 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 beimportable from everywhere)
+if isdir('_narval'): # test REQUIRED (to be importable from everywhere)
     data_files.append([join('share', 'narval', 'checkers'),
                        listdir(join('_narval', 'checkers'))])
     data_files.append([join('share', 'narval', 'checkers', modname),
@@ -65,6 +65,6 @@
                        listdir(join('_narval', 'preprocessors'))])
     data_files.append([join('share', 'narval', 'preprocessors', modname),
                        listdir(join('_narval', 'preprocessors', modname))])
-if isdir('ext'): # test REQUIRED (to beimportable from everywhere)
-    data_files.append([join('share', 'narval', 'data', modname),
+if isdir(join('_narval', 'data')): # test REQUIRED (to be importable from everywhere)
+    data_files.append([join('share', 'narval', 'data'),
                        listdir(join('_narval', 'data'))])
--- a/_narval/checkers/apycot/jslint.py	Wed May 14 16:05:06 2014 +0200
+++ b/_narval/checkers/apycot/jslint.py	Wed May 14 22:11:38 2014 +0200
@@ -5,14 +5,17 @@
 from os.path import exists, dirname, join, abspath
 from re import compile
 
+from narvalbot import INSTALL_PREFIX, MODE
 from apycotlib import register, OutputParser, ParsedCommand, FAILURE
 from checkers.apycot import AbstractFilteredFileChecker
 
-# in source installation, jslint.js is in apycot/ext, we're currently in
-# apycot/_apycotlib/checkers/apycot
-JSLINT_PATH = join(dirname(dirname(dirname(abspath(__file__)))), 'data', 'jslint.js')
-if not exists(JSLINT_PATH):
-    JSLINT_PATH = '/usr/share/narval/data/apycot/jslint.js'
+if MODE == 'dev':
+    import checkers
+    NARVALDIR = dirname(dirname(checkers.__file__))
+else:
+    NARVALDIR = join(INSTALL_PREFIX, 'share', 'narval')
+JSLINT_PATH = join(NARVALDIR, 'data', 'jslint.js')
+
 
 class JsLintParser(OutputParser):
     """Simple Parser class interpretting