[Zope3-checkins] SVN: Zope3/branches/3.3/ Merge from trunk:
Philipp von Weitershausen
philikon at philikon.de
Fri Aug 11 17:40:51 EDT 2006
Log message for revision 69413:
Merge from trunk:
Log message for revision 69412:
Fix collector #683: Globally installed "zope" package breaks mkzopeinstance
Changed:
U Zope3/branches/3.3/doc/CHANGES.txt
U Zope3/branches/3.3/src/zope/app/server/mkzopeinstance.py
U Zope3/branches/3.3/src/zope/app/server/tests/test_mkzopeinstance.py
-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt 2006-08-11 21:32:24 UTC (rev 69412)
+++ Zope3/branches/3.3/doc/CHANGES.txt 2006-08-11 21:40:50 UTC (rev 69413)
@@ -10,6 +10,9 @@
Bugfixes
+ - Fixed issue 683, Globally installed "zope" package breaks
+ mkzopeinstance.
+
- Fixed issue 676, utilities defined in Zope 3.2 weren't
converted properly.
Modified: Zope3/branches/3.3/src/zope/app/server/mkzopeinstance.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/server/mkzopeinstance.py 2006-08-11 21:32:24 UTC (rev 69412)
+++ Zope3/branches/3.3/src/zope/app/server/mkzopeinstance.py 2006-08-11 21:40:50 UTC (rev 69413)
@@ -26,14 +26,11 @@
import os
import shutil
import sys
+from xml.sax.saxutils import quoteattr as xml_quoteattr
-from xml.sax.saxutils import quoteattr as xml_quoteattr
-
-import zope
-
+import zope.app.server
from zope.app.authentication import password
from zope.app.applicationcontrol import zopeversion
-import zope.app.server
def main(argv=None, from_checkout=False):
"""Top-level script function to create a new Zope instance."""
@@ -210,7 +207,7 @@
# TODO we should be able to compute the script
script = os.path.abspath(sys.argv[0])
zope_home = os.path.dirname(os.path.dirname(script))
- zope_init = os.path.abspath(zope.__file__)
+ zope_init = os.path.dirname(os.path.abspath(zope.app.__file__))
software_home = os.path.dirname(os.path.dirname(zope_init))
self.replacements = [
("<<USERNAME>>", options.username),
Modified: Zope3/branches/3.3/src/zope/app/server/tests/test_mkzopeinstance.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/server/tests/test_mkzopeinstance.py 2006-08-11 21:32:24 UTC (rev 69412)
+++ Zope3/branches/3.3/src/zope/app/server/tests/test_mkzopeinstance.py 2006-08-11 21:40:50 UTC (rev 69413)
@@ -354,7 +354,39 @@
self.failUnless(app.all_input_consumed())
self.failUnless(os.path.exists(os.path.join(self.instance, "etc")))
+ def test_zope_namespace_package_doesnt_affect_software_home(self):
+ # Make sure that a zope namespace package in a different
+ # location won't affect SOFTWARE_HOME
+ # let's mess with zope's __file__
+ import zope
+ old_path = zope.__file__
+ zope.__file__ = os.path.join(
+ *'and now for something completely different'.split())
+
+ # place a test file into the skeleton dir that'll be expanded
+ # to SOFTWARE_HOME by mkzopeinstance
+ f = file(os.path.join(self.skeleton, 'test.in'), 'w')
+ f.write('<<SOFTWARE_HOME>>')
+ f.close()
+
+ # run mkzopeinstance
+ options = self.createOptions()
+ options.destination = self.instance
+ app = ControlledInputApplication(options, [])
+ rc = app.process()
+
+ # check for the expected output: mkzopeinstance should take
+ # zope.app as an anchor for determining SOFTWARE_HOME
+ import zope.app
+ expected = os.path.dirname(os.path.dirname(
+ os.path.dirname(zope.app.__file__)))
+ self.assertEqual(file(os.path.join(self.instance, 'test')).read(),
+ expected)
+
+ # cleanup the fake 'zope' module
+ zope.__file__ = old_path
+
class ControlledInputApplication(mkzopeinstance.Application):
def __init__(self, options, input_lines):
More information about the Zope3-Checkins
mailing list