Commit 2419ac85 authored by Jérome Perrin's avatar Jérome Perrin

find zope home from SOFTWARE_HOME enironment variable before trying to guess

from some common paths. This is required if you want to run tests from buildout
where ERP5 is not installed on the machine


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28665 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 38fb9e20
...@@ -46,7 +46,7 @@ Options: ...@@ -46,7 +46,7 @@ Options:
to erp5_sql_connection_string) to erp5_sql_connection_string)
--email_from_address=STRING --email_from_address=STRING
Initialise the email_from_address property of the Initialise the email_from_address property of the
portal, by defaults, CMFActivity failures are sent portal, by default, CMFActivity failures are sent
on localhost from this address, to this address on localhost from this address, to this address
--erp5_catalog_storage=STRING --erp5_catalog_storage=STRING
Use the given business template as erp5_catalog Use the given business template as erp5_catalog
...@@ -118,7 +118,9 @@ def initializeInstanceHome(tests_framework_home, ...@@ -118,7 +118,9 @@ def initializeInstanceHome(tests_framework_home,
shutil.copy(src, dst) shutil.copy(src, dst)
else: else:
os.symlink(src, dst) os.symlink(src, dst)
# add some paths where we can find copyzopeskel
sys.path.append(os.path.join(zope_home, "bin")) sys.path.append(os.path.join(zope_home, "bin"))
sys.path.append(os.path.join(zope_home, "utilities"))
import copyzopeskel import copyzopeskel
kw = { kw = {
"PYTHON":sys.executable, "PYTHON":sys.executable,
...@@ -130,23 +132,31 @@ def initializeInstanceHome(tests_framework_home, ...@@ -130,23 +132,31 @@ def initializeInstanceHome(tests_framework_home,
copyzopeskel.copyskel(skelsrc, instance_home, None, None, **kw) copyzopeskel.copyskel(skelsrc, instance_home, None, None, **kw)
# site specific variables # site specific variables
tests_framework_home = os.path.dirname(os.path.abspath(__file__)) tests_framework_home = os.path.dirname(os.path.abspath(__file__))
# handle 64bit architecture and windows # find zope home, either from SOFTWARE_HOME environment variable, or by
if WIN: # guessing some common paths.
erp5_home = os.path.sep.join( if 'SOFTWARE_HOME' in os.environ:
tests_framework_home.split(os.path.sep)[:-4]) software_home = os.environ['SOFTWARE_HOME']
zope_home = os.path.join(erp5_home, 'Zope') if not os.path.exists(software_home):
elif os.path.isdir('/usr/lib64/zope/lib/python'): raise ValueError('SOFTWARE_HOME is set to non existing directory %r'
zope_home = '/usr/lib64/zope' % (software_home,))
elif os.path.isdir('/usr/lib/erp5/lib/python'): # software_home is zope_home/lib/python, remove lib/python
zope_home = '/usr/lib/erp5' zope_home = os.path.split(os.path.split(software_home)[0])[0]
elif os.path.isdir('/usr/lib/zope2.8/lib/python'):
zope_home = '/usr/lib/zope2.8'
else: else:
zope_home = '/usr/lib/zope' if WIN:
software_home = os.path.join(zope_home, 'lib', 'python') erp5_home = os.path.sep.join(
tests_framework_home.split(os.path.sep)[:-4])
zope_home = os.path.join(erp5_home, 'Zope')
elif os.path.isdir('/usr/lib64/zope/lib/python'):
zope_home = '/usr/lib64/zope'
elif os.path.isdir('/usr/lib/erp5/lib/python'):
zope_home = '/usr/lib/erp5'
elif os.path.isdir('/usr/lib/zope2.8/lib/python'):
zope_home = '/usr/lib/zope2.8'
else:
zope_home = '/usr/lib/zope'
software_home = os.path.join(zope_home, 'lib', 'python')
# handle 'system global' instance and windows # handle 'system global' instance and windows
if WIN: if WIN:
......
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