Commit 701eeb0b authored by Arnaud Fontaine's avatar Arnaud Fontaine

stack/erp5: SOFTWARE_HOME was incorrectly set to Zope2.egg/Zope2.

As SOFTWARE_HOME is added at the top of sys.path, this meant that Zope2.egg/Zope2
ended up at the top of sys.path:
  * This broke `imp.find_module('App')` and Pylint (`No name 'Extensions' in
    module 'App' (no-name-in-module)`) because there are `App` modules in both
    Zope2.egg/Zope2/ and Zope2.egg/ and the former was returned.
  * "Normal" instances and Products.ERP5Type.tests.runUnitTest properly set up
    SOFTWARE_HOME to Zope2.egg/.

Additionally, according to Zope2/Testing documentation, SOFTWARE_HOME is only
needed to find Zope2.egg/Testing module, already available as Zope2.egg is in
sys.path.
parent 69cb4b3c
Pipeline #9182 failed with stage
in 0 seconds
......@@ -327,12 +327,10 @@ entry-points =
runUnitTest=runUnitTest:main
scripts = runUnitTest
initialization =
import glob, imp, os, sys
import App # prevent Testing from importing Zope2.App instead of App
import glob, os, sys
import Products
Products.__path__[:0] = filter(None,
os.getenv('INSERT_PRODUCTS_PATH', '').split(os.pathsep))
os.environ['SOFTWARE_HOME'] = os.path.abspath(imp.find_module('Zope2')[1])
os.environ['ZOPE_SCRIPTS'] = ''
parts_directory = '''${buildout:parts-directory}'''
repository_id_list = \
......@@ -365,8 +363,6 @@ initialization =
import sys
import Products
[Products.__path__.insert(0, p) for p in reversed(os.environ.get('INSERT_PRODUCTS_PATH', '').split(':')) if p]
import Zope2
os.environ['SOFTWARE_HOME'] = os.path.abspath(os.path.dirname(os.path.dirname(Zope2.__file__)))
os.environ['ZOPE_SCRIPTS'] = ''
repository_id_list = list(reversed('''${erp5_repository_list:repository_id_list}'''.split()))
sys.path[0:0] = ['/'.join(['''${buildout:parts-directory}''', x]) for x in repository_id_list]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment