Closes #2054465 by adding special case for cubes on installation path detection stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Tue, 25 Oct 2011 09:42:20 +0200
branchstable
changeset 785 7d8a3645e20d
parent 784 ea252e8f058d
child 786 ab57104e5667
Closes #2054465 by adding special case for cubes on installation path detection Also properly update python path when a cube is detected so that non standard 'cubes' directory is in sys.path.
_apycotlib/checkers/python.py
--- a/_apycotlib/checkers/python.py	Tue Oct 25 09:18:35 2011 +0200
+++ b/_apycotlib/checkers/python.py	Tue Oct 25 09:42:20 2011 +0200
@@ -1,7 +1,7 @@
 """checkers for python source files
 
 :organization: Logilab
-:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
 :contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
 :license: General Public License version 2 - http://www.gnu.org/licenses
 """
@@ -56,9 +56,14 @@
         from logilab.devtools.lib.pkginfo import PackageInfo
         pkginfo = PackageInfo(directory=test.project_path())
         modname = getattr(pkginfo, 'modname', None)
+        distname = getattr(pkginfo, 'distname', None)
         package = getattr(pkginfo, 'subpackage_of', None)
         if modname and package:
             modname = '%s.%s' % (package, modname)
+        elif distname.startswith('cubicweb-'):
+            cubespdir = join(os.environ['APYCOT_ROOT'], 'local', 'share', 'cubicweb')
+            test.update_env('PYTHONPATH', cubespdir)
+            return join(cubespdir, 'cubes', modname)
     if modname:
         try:
             path = join(INSTALL_PREFIX[test.project_path()], *modname.split('.'))