[Checkins] SVN: zc.recipe.zope3instance/branches/dev/src/zc/recipe/zope3instance/__init__.py Fixed bug: recipe was relying on existence of zope3 installation at

Jim Fulton jim at zope.com
Mon Oct 30 10:56:47 EST 2006


Log message for revision 70996:
  Fixed bug: recipe was relying on existence of zope3 installation at
  initialization time.
  

Changed:
  U   zc.recipe.zope3instance/branches/dev/src/zc/recipe/zope3instance/__init__.py

-=-
Modified: zc.recipe.zope3instance/branches/dev/src/zc/recipe/zope3instance/__init__.py
===================================================================
--- zc.recipe.zope3instance/branches/dev/src/zc/recipe/zope3instance/__init__.py	2006-10-30 12:13:58 UTC (rev 70995)
+++ zc.recipe.zope3instance/branches/dev/src/zc/recipe/zope3instance/__init__.py	2006-10-30 15:56:47 UTC (rev 70996)
@@ -29,45 +29,23 @@
 
     def __init__(self, buildout, name, options):
         self.options, self.name = options, name
+        
 
         options['location'] = os.path.join(
             buildout['buildout']['parts-directory'],
             self.name,
             )
+
         
-        z3 = options.get('zope3', 'zope3')
-        z3path = buildout[z3]['location']
-        self.zope3 = z3path
-        if not os.path.exists(z3path):
-            raise zc.buildout.UserError("No directory:", z3path)
+        options['zope3-location'] = buildout[options.get('zope3', 'zope3')
+                                             ]['location']
 
-        path = os.path.join(z3path, 'lib', 'python')
-        if not os.path.exists(path):
-            path = os.path.join(z3path, 'src')
-            if not os.path.exists(path):
-                logger.error(
-                    "The directory, %r, isn't a valid checkout or release."
-                    % z3)
-                raise zc.buildout.UserError(
-                    "Invalid Zope 3 installation:", z3path)
-
-        skel = os.path.join(z3path, 'zopeskel', 'etc')
-        if not os.path.exists(skel):
-            logger.error("%r does not exists.", skel)
-            raise UserError("Invalid Zope 3 Installation", src)
-
         if len(options['user'].split(':')) not in (2,3):
             logger.error(
                 "The user option must specify a login name,"
                 " a password manager and a password.")
             raise UserError("Invalud user, %r", options['user'])
 
-        extra = options.get('extra-paths')
-        if extra:
-            extra += '\n' + path
-        else:
-            extra = path
-
         options['database-config'] = '\n'.join([
             buildout[section]['zconfig']
             for section in options['database'].split()
@@ -95,17 +73,44 @@
 
         # Let the egg recipe do much of the heavy lifting.
         options['scripts'] = ''
-        options['extra-paths'] = extra
         options.pop('entry-points', None)
         self.egg = zc.recipe.egg.Egg(buildout, name, options)
 
     def install(self):
         options = self.options
+
+        z3path = options['zope3-location']
+        if not os.path.exists(z3path):
+            raise zc.buildout.UserError("No directory:", z3path)
+
+        path = os.path.join(z3path, 'lib', 'python')
+        if not os.path.exists(path):
+            path = os.path.join(z3path, 'src')
+            if not os.path.exists(path):
+                logger.error(
+                    "The directory, %r, isn't a valid checkout or release."
+                    % z3)
+                raise zc.buildout.UserError(
+                    "Invalid Zope 3 installation:", z3path)
+
+        extra = options.get('extra-paths')
+        if extra:
+            extra += '\n' + path
+        else:
+            extra = path
+        options['extra-paths'] = extra
+
+        skel = os.path.join(z3path, 'zopeskel', 'etc')
+        if not os.path.exists(skel):
+            logger.error("%r does not exists.", skel)
+            raise UserError("Invalid Zope 3 Installation", src)
+
+
         dest = options['location']
+        log_dir = run_dir = subprogram_dir = config_dir = dest
         requirements, ws = self.egg.working_set()
 
         os.mkdir(dest)
-        log_dir = run_dir = subprogram_dir = config_dir = dest
 
         site_zcml_path = os.path.join(config_dir, 'site.zcml')
 
@@ -139,7 +144,7 @@
             ))
 
         # Install zcml files
-        self._zcml(self.zope3, config_dir, options)
+        self._zcml(options['zope3-location'], config_dir, options)
 
         # install subprohrams and ctl scripts
         zc.buildout.easy_install.scripts(



More information about the Checkins mailing list