[pkg] checkers should now be installed in narval.checkers.apycot (closes #3241608)
authorDavid Douard <david.douard@logilab.fr>
Tue, 22 Oct 2013 22:36:45 +0200
changeset 1451 fed7d546699f
parent 1450 2e257c617a67
child 1452 ab2a19b30283
[pkg] checkers should now be installed in narval.checkers.apycot (closes #3241608) but they should still be available from source (when running unit tests), so make sure apycot/__init__.py fake the installed situation. The dummy 'checkers' module is necessary to create 'checkers.apycot'
__init__.py
__pkginfo__.py
_apycotlib/checkers/debian.py
_apycotlib/checkers/jslint.py
_apycotlib/checkers/python.py
_apycotlib/checkers/scenarios.py
debian/narval-apycot.dirs
debian/rules
recipes.py
setup.py
test/unittest_checkers.py
--- a/__init__.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/__init__.py	Tue Oct 22 22:36:45 2013 +0200
@@ -11,3 +11,6 @@
 else:
     import sys
     sys.modules['apycotlib'] = _apycotlib
+    import _apycotlib.checkers
+    sys.modules['checkers'] = _apycotlib.checkers
+    sys.modules['checkers.apycot'] = _apycotlib.checkers
--- a/__pkginfo__.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/__pkginfo__.py	Tue Oct 22 22:36:45 2013 +0200
@@ -56,7 +56,5 @@
 # Note: here, you'll need to add subdirectories if you want
 # them to be included in the debian package
 
-if isdir('narval'):
-    data_files.append([join('var', 'lib', 'narval', 'plugins'), listdir('narval')])
 if isdir('ext'):
     data_files.append([join('share', 'apycot', 'ext'), listdir('ext')])
--- a/_apycotlib/checkers/debian.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/_apycotlib/checkers/debian.py	Tue Oct 22 22:36:45 2013 +0200
@@ -2,7 +2,7 @@
 import logging
 import os
 import subprocess
-from apycotlib.checkers import BaseChecker
+from checkers.apycot import BaseChecker
 
 def find_with_extension(path, extension):
     path = os.path.expanduser(path)
--- a/_apycotlib/checkers/jslint.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/_apycotlib/checkers/jslint.py	Tue Oct 22 22:36:45 2013 +0200
@@ -6,7 +6,7 @@
 from re import compile
 
 from apycotlib import register, OutputParser, ParsedCommand, FAILURE
-from apycotlib.checkers import AbstractFilteredFileChecker
+from checkers.apycot import AbstractFilteredFileChecker
 
 # in source installation, jslint.js is in apycot/ext, we're currently in
 # apycot/_apycotlib/checkers
--- a/_apycotlib/checkers/python.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/_apycotlib/checkers/python.py	Tue Oct 22 22:36:45 2013 +0200
@@ -36,9 +36,10 @@
 from apycotlib import register
 from apycotlib import SUCCESS, FAILURE, PARTIAL, NODATA, ERROR
 from apycotlib import SimpleOutputParser, ParsedCommand
-from apycotlib.checkers import BaseChecker, AbstractFilteredFileChecker
 from apycotlib.preprocessors.distutils import INSTALL_PREFIX, pyversions
 
+from checkers.apycot import BaseChecker, AbstractFilteredFileChecker
+
 def pyinstall_path(test):
     path = _pyinstall_path(test)
     if not exists(path):
--- a/_apycotlib/checkers/scenarios.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/_apycotlib/checkers/scenarios.py	Tue Oct 22 22:36:45 2013 +0200
@@ -1,9 +1,10 @@
 import os
 from commands import getstatusoutput
 from apycotlib import SUCCESS, FAILURE, ERROR
-from apycotlib.checkers import AbstractFilteredFileChecker
 from apycotlib import register
 
+from checkers.apycot import AbstractFilteredFileChecker
+
 class ScriptRunner(AbstractFilteredFileChecker):
     """
     run files accepted by the filter
--- a/debian/narval-apycot.dirs	Wed Sep 18 13:29:47 2013 +0200
+++ b/debian/narval-apycot.dirs	Tue Oct 22 22:36:45 2013 +0200
@@ -1,3 +1,2 @@
-var/lib
-usr/lib
-usr/share
+usr/lib/
+usr/share/
--- a/debian/rules	Wed Sep 18 13:29:47 2013 +0200
+++ b/debian/rules	Tue Oct 22 22:36:45 2013 +0200
@@ -24,8 +24,9 @@
 	dh_clean -k
 	dh_installdirs -i
 	NO_SETUPTOOLS=1 python setup.py -q install --no-compile --prefix=debian/cubicweb-apycot/usr/
-	mv debian/cubicweb-apycot/usr/share/apycot debian/narval-apycot/usr/share
+	mv debian/cubicweb-apycot/usr/share/apycot debian/narval-apycot/usr/share/
 	mv debian/cubicweb-apycot/usr/lib/python* debian/narval-apycot/usr/lib/
+	mv debian/narval-apycot/usr/lib/python*/site-packages/narval debian/narval-apycot/usr/share/
 
 
 # Build architecture-independent files here.
--- a/recipes.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/recipes.py	Tue Oct 22 22:36:45 2013 +0200
@@ -1,7 +1,7 @@
 """functions to create defaut apycot recipes"""
 
 quick_script = u'''
-from apycotlib.checkers import python # trigger registration
+from checkers.apycot import python # trigger registration
 from apycotlib import narvalactions as na
 # `plan`
 
@@ -15,7 +15,7 @@
 
 full_script = u'''
 from apycotlib import registered, narvalactions as na
-from apycotlib.checkers import python # trigger registration
+from checkers.apycot import python # trigger registration
 # `plan`
 
 with na.apycot_environment(plan) as test:
@@ -31,7 +31,7 @@
 scenario_runner_script = u'''
 import os
 from apycotlib import narvalactions as na
-from apycotlib.checkers.scenarios import ScriptRunner
+from checkers.apycot.scenarios import ScriptRunner
 
 class ScenarioChecker(ScriptRunner):
     id = "scenario_checker"
--- a/setup.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/setup.py	Tue Oct 22 22:36:45 2013 +0200
@@ -145,10 +145,12 @@
     if USE_SETUPTOOLS and install_requires:
         kwargs['install_requires'] = install_requires
         kwargs['dependency_links'] = dependency_links
-    kwargs['packages'] = 'apycotlib', 'apycotlib.preprocessors', 'apycotlib.checkers'
+    kwargs['packages'] = ('apycotlib',
+                          'apycotlib.preprocessors',
+                          'narval.checkers.apycot')
     kwargs['package_dir'] = {'apycotlib' : '_apycotlib',
                              'apycotlib.preprocessors': '_apycotlib/preprocessors',
-                             'apycotlib.checkers': '_apycotlib/checkers',
+                             'narval.checkers.apycot': '_apycotlib/checkers',
                              }
     return setup(name = distname,
                  version = version,
--- a/test/unittest_checkers.py	Wed Sep 18 13:29:47 2013 +0200
+++ b/test/unittest_checkers.py	Tue Oct 22 22:36:45 2013 +0200
@@ -11,17 +11,13 @@
 
 from logilab.common.testlib import unittest_main, TestCase, TestSuite
 
-from utils import * # import this first
+from utils import MockTest, MockRepository, MockCheckWriter, input_path
 
 zope_path = os.environ.get('SOFTWARE_HOME', '/usr/lib/zope/lib/python')
 sys.path.insert(1, zope_path)
 
 from apycotlib import SUCCESS, FAILURE, PARTIAL, NODATA, ERROR
-from apycotlib.checkers.python import *
-#from apycotlib.checkers.chks_xml import *
-#from apycotlib.checkers.chks_rest import *
-#from apycotlib.checkers.chks_pkg import *
-#from apycotlib.checkers import chks_pt
+from checkers.apycot.python import *
 
 WRITER = MockCheckWriter()