Should I report bugs for zc.recipe.zope3instance (I have a possible
patch too! ;) in the Zope-3 collector, or in the zc.buildout's lanchpad
bug tracker?


Well since I'm not sure where to put it, let me attach a patch "that
works for me", in case it is useful for someone.

kind regards,
jw
--
Jan-Wijbrand Kolman
--- zc.recipe.zope3instance/src/zc/recipe/zope3instance/__init__.py	2006-11-09 15:03:49.000000000 +0100
+++ zc.recipe.zope3instance-win32/src/zc/recipe/zope3instance/__init__.py	2006-11-13 11:30:50.000000000 +0100
@@ -1,4 +1,4 @@
-import os, re, shutil
+import os, os.path, sys, re, shutil
 import zc.buildout
 import zc.recipe.egg

@@ -41,18 +41,33 @@

             # The working set has changed.  Blow away the instance.
             shutil.rmtree(location)
-
+
         # What follows is a bit of a hack because the instance-setup mechanism
         # is a bit monolithic.  We'll run mkzopeinstabce and then we'll
         # patch the result.  A better approach might be to provide independent
         # instance-creation logic, but this raises lots of issues that
         # need to be stored out first.
-        mkzopeinstance = os.path.join(options['zope3-directory'],
-                                      'bin', 'mkzopeinstance')

+        if sys.platform == 'win32' and \
+                os.path.normpath(os.path.dirname(options['executable'])) ==\
+                os.path.normpath(options['zope3-directory']):
+            # If the zope3-directory (as configured using the location directive
+            # in a [zope3] section in the buildout.cfg) points to the Python
+            # installation, we assume Zope is installed using the Windows
+            # installer. We assume a lot here.
+            mkzopeinstance = os.path.join(
+                options['zope3-directory'], 'Scripts', 'mkzopeinstance'
+                )
+            # We need to escape the backward slashes since it is passed
+            # as a command line argument.
+            location = location.replace('\\', '\\\\')
+        else:
+            mkzopeinstance = os.path.join(
+                options['zope3-directory'], 'bin', 'mkzopeinstance'
+                )
         assert os.spawnl(
             os.P_WAIT, options['executable'], options['executable'],
-            mkzopeinstance, '-d', location, '-u', options['user'],
+            mkzopeinstance, '-d', '"%s"'%location, '-u', options['user'],
             '--non-interactive',
             ) == 0
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to