[Erp5-report] r41252 kazuhiko - in /erp5/trunk/utils/erp5.recipe.zope2instance: ./ src/erp5...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Dec 9 10:45:50 CET 2010


Author: kazuhiko
Date: Thu Dec  9 10:45:50 2010
New Revision: 41252

URL: http://svn.erp5.org?rev=41252&view=rev
Log:
* update erp5.recipe.zope2instance egg.

2.0 (2010-12-09)
----------------

- Modify for Zope-2.12.
  [kazuhiko]

.. ATTENTION::
   This release is targeted at Zope 2.12+ and Python 2.6. If you are using
   this recipe with earlier versions of Zope or Python, you should use one
   of the releases from the 1.x series.

Modified:
    erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt
    erp5/trunk/utils/erp5.recipe.zope2instance/README.txt
    erp5/trunk/utils/erp5.recipe.zope2instance/setup.py
    erp5/trunk/utils/erp5.recipe.zope2instance/src/erp5/recipe/zope2instance/__init__.py

Modified: erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt?rev=41252&r1=41251&r2=41252&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt [utf8] Thu Dec  9 10:45:50 2010
@@ -1,6 +1,12 @@
 Changelog
 =========
 
+2.0 (2010-12-09)
+----------------
+
+- Modify for Zope-2.12.
+  [kazuhiko]
+
 1.3.1 (2010-06-24)
 ----------------
 

Modified: erp5/trunk/utils/erp5.recipe.zope2instance/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2instance/README.txt?rev=41252&r1=41251&r2=41252&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2instance/README.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.zope2instance/README.txt [utf8] Thu Dec  9 10:45:50 2010
@@ -4,6 +4,11 @@ Introduction
 This recipe is a patched version of plone.recipe.zope2instance that
 creates more directories required by ERP5.
 
+.. ATTENTION::
+   This release is targeted at Zope 2.12+ and Python 2.6. If you are using
+   this recipe with earlier versions of Zope or Python, you should use one
+   of the releases from the 1.x series.
+
 Example
 =======
 

Modified: erp5/trunk/utils/erp5.recipe.zope2instance/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2instance/setup.py?rev=41252&r1=41251&r2=41252&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2instance/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.zope2instance/setup.py [utf8] Thu Dec  9 10:45:50 2010
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 
 name = "erp5.recipe.zope2instance"
-version = '1.3.1'
+version = '2.0'
 
 def read(name):
     return open(name).read()
@@ -32,7 +32,7 @@ setup(
     package_dir = {'':'src'},
     namespace_packages = ['erp5', 'erp5.recipe'],
     install_requires = [
-        'plone.recipe.zope2instance==3.6',
+        'plone.recipe.zope2instance >= 4.1.2',
     ],
     zip_safe=False,
     entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},

Modified: erp5/trunk/utils/erp5.recipe.zope2instance/src/erp5/recipe/zope2instance/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2instance/src/erp5/recipe/zope2instance/__init__.py?rev=41252&r1=41251&r2=41252&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2instance/src/erp5/recipe/zope2instance/__init__.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.zope2instance/src/erp5/recipe/zope2instance/__init__.py [utf8] Thu Dec  9 10:45:50 2010
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 ##############################################################################
 #
-# Copyright (c) 2009 Nexedi SARL and Contributors. All Rights Reserved.
+# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
 # Copyright (c) 2006-2008 Zope Corporation and Contributors.
 #
 # This software is subject to the provisions of the Zope Public License,
@@ -12,55 +12,32 @@
 # FOR A PARTICULAR PURPOSE.
 #
 ##############################################################################
-import os, shutil, sys
-import zc.buildout
+import os, shutil
+import pkg_resources
 import plone.recipe.zope2instance
+from plone.recipe.zope2instance import make
 
 class Recipe(plone.recipe.zope2instance.Recipe):
-    def install(self):
+    def install(self, update=False):
         # Override plone.recipe.zope2instance so as to prepare several
         # directories used by ERP5.
         options = self.options
         location = options['location']
 
-        requirements, ws = self.egg.working_set()
-        ws_locations = [d.location for d in ws]
-
-        if os.path.exists(location):
-            shutil.rmtree(location)
+        if not update:
+            if os.path.exists(location):
+                shutil.rmtree(location)
 
-        # What follows is a bit of a hack because the instance-setup mechanism
-        # is a bit monolithic. We'll run mkzopeinstance 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.
-        if not self.zope2_location:
-            mkzopeinstance = os.path.join(
-                options['bin-directory'], 'mkzopeinstance')
-            if not mkzopeinstance:
-                # EEE
-                return
-
-        else:
-            mkzopeinstance = os.path.join(
-                self.zope2_location, 'bin', 'mkzopeinstance.py')
-            if not os.path.exists(mkzopeinstance):
-                mkzopeinstance = os.path.join(
-                    self.zope2_location, 'utilities', 'mkzopeinstance.py')
-            if sys.platform[:3].lower() == "win":
-                mkzopeinstance = '"%s"' % mkzopeinstance
-
-        if not mkzopeinstance:
-            # EEE
-            return
-
-        assert os.spawnl(
-            os.P_WAIT, os.path.normpath(options['executable']),
-            zc.buildout.easy_install._safe_arg(options['executable']),
-            mkzopeinstance, '-d',
-            zc.buildout.easy_install._safe_arg(location),
-            '-u', options['user'],
-            ) == 0
+            # Which Zope2 version do we have?
+            dist = pkg_resources.get_distribution('Zope2')
+            parsed = dist.parsed_version
+            major, minor = parsed[0:2]
+            major, minor = int(major), int(minor)
+            # We only support creating instances for 2.12 and 2.13
+            if minor > 13:
+                minor = 13
+            version = str(major) + str(minor)
+            make.make_instance(options.get('user', None), location, version)
 
         # patch begin: create several directories and symlinks for ERP5
         base_dir = self.buildout['buildout']['directory']
@@ -78,24 +55,20 @@ class Recipe(plone.recipe.zope2instance.
             if not os.path.exists(link_path):
                 os.symlink(real_path, link_path)
         for directory in ('bt5',):
+            real_path = os.path.join(location, '..', directory)
+            if not os.path.exists(real_path):
+                os.mkdir(real_path)
             path = os.path.join(location, directory)
             if os.path.exists(path) and not os.path.islink(path):
                 shutil.rmtree(path)
             if not os.path.exists(path):
-                os.symlink(os.path.join('..', directory), path)
-        # patch end: create several directories and a symlink for ERP5
+                os.symlink(real_path, path)
+        # patch end: create several directories and symlinks for ERP5
 
         try:
-            # Save the working set:
-            open(os.path.join(location, 'etc', '.eggs'), 'w').write(
-                '\n'.join(ws_locations))
-
             # Make a new zope.conf based on options in buildout.cfg
             self.build_zope_conf()
 
-            # Patch extra paths into binaries
-            self.patch_binaries(ws_locations)
-
             # Install extra scripts
             self.install_scripts()
 



More information about the Erp5-report mailing list