[Erp5-report] r30864 - in /erp5/trunk/utils/erp5.recipe.zope2install: ./ src/ src/erp5/ src...

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Nov 25 22:34:44 CET 2009


Author: kazuhiko
Date: Wed Nov 25 22:34:43 2009
New Revision: 30864

URL: http://svn.erp5.org?rev=30864&view=rev
Log:
This recipe is a patched version of plone.recipe.zope2install that
supports 'patch' option so as to install Zope with the aq_dynamic patch.

- Based on plone.recipe.zope2install-3.2. 'patch' option supports URL too.

Added:
    erp5/trunk/utils/erp5.recipe.zope2install/
    erp5/trunk/utils/erp5.recipe.zope2install/CHANGES.txt   (with props)
    erp5/trunk/utils/erp5.recipe.zope2install/README.txt   (with props)
    erp5/trunk/utils/erp5.recipe.zope2install/setup.py
    erp5/trunk/utils/erp5.recipe.zope2install/src/
    erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/
    erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/__init__.py
    erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/
    erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/__init__.py
    erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/zope2install/
    erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/zope2install/__init__.py

Added: erp5/trunk/utils/erp5.recipe.zope2install/CHANGES.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2install/CHANGES.txt?rev=30864&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2install/CHANGES.txt (added)
+++ erp5/trunk/utils/erp5.recipe.zope2install/CHANGES.txt [utf8] Wed Nov 25 22:34:43 2009
@@ -1,0 +1,8 @@
+Changelog
+=========
+
+0.1 (2009-11-25)
+----------------
+
+- Based on plone.recipe.zope2install-3.2. 'patch' option supports URL too.
+  [kazuhiko]

Propchange: erp5/trunk/utils/erp5.recipe.zope2install/CHANGES.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: erp5/trunk/utils/erp5.recipe.zope2install/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2install/README.txt?rev=30864&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2install/README.txt (added)
+++ erp5/trunk/utils/erp5.recipe.zope2install/README.txt [utf8] Wed Nov 25 22:34:43 2009
@@ -1,0 +1,28 @@
+Introduction
+============
+
+This recipe is a patched version of plone.recipe.zope2install that
+supports 'patch' option so as to install Zope with the aq_dynamic patch.
+
+zope2instance
+  This recipe is a patched version of plone.recipe.zope2instance that
+  creates more directories required by ERP5.
+
+Example
+=======
+
+You can use it with a part like this::
+
+  [zope2]
+  recipe = erp5.recipe.zope2install
+  url = http://www.zope.org/Products/Zope/2.8.11/Zope-2.8.11-final.tgz
+  patch = https://svn.erp5.org/repos/public/experimental/erp5.buildout/patches/Zope-2.8.0-final-aq_dynamic.patch
+
+Options
+=======
+
+patch
+  The url or path to the patch to be applied. Please note that the patch
+  will be applied with 'patch -p1' command.
+
+See plone.recipe.zope2install's document for other options.

Propchange: erp5/trunk/utils/erp5.recipe.zope2install/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: erp5/trunk/utils/erp5.recipe.zope2install/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2install/setup.py?rev=30864&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2install/setup.py (added)
+++ erp5/trunk/utils/erp5.recipe.zope2install/setup.py [utf8] Wed Nov 25 22:34:43 2009
@@ -1,0 +1,39 @@
+from setuptools import setup, find_packages
+
+name = "erp5.recipe.zope2install"
+version = '1.0'
+
+def read(name):
+    return open(name).read()
+
+long_description=(
+        read('README.txt')
+        + '\n' +
+        read('CHANGES.txt')
+    )
+
+setup(
+    name = name,
+    version = version,
+    author = "Kazuhiko Shiozaki",
+    author_email = "kazuhiko at nexedi.com",
+    description = "ZC Buildout recipe for installing a Zope 2 with applying a patch.",
+    long_description=long_description,
+    license = "ZPL 2.1",
+    keywords = "zope2 buildout",
+    url='http://pypi.python.org/pypi/erp5.recipe.zope2instance',
+    classifiers=[
+      "License :: OSI Approved :: Zope Public License",
+      "Framework :: Buildout",
+      "Framework :: Zope2",
+      ],
+    packages = find_packages('src'),
+    include_package_data = True,
+    package_dir = {'':'src'},
+    namespace_packages = ['erp5', 'erp5.recipe'],
+    install_requires = [
+        'plone.recipe.zope2install',
+    ],
+    zip_safe=False,
+    entry_points = {'zc.buildout': ['default = %s:Recipe' % name]},
+    )

Added: erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/__init__.py?rev=30864&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/__init__.py (added)
+++ erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/__init__.py [utf8] Wed Nov 25 22:34:43 2009
@@ -1,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)

Added: erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/__init__.py?rev=30864&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/__init__.py (added)
+++ erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/__init__.py [utf8] Wed Nov 25 22:34:43 2009
@@ -1,0 +1,6 @@
+# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages
+try:
+    __import__('pkg_resources').declare_namespace(__name__)
+except ImportError:
+    from pkgutil import extend_path
+    __path__ = extend_path(__path__, __name__)

Added: erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/zope2install/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/zope2install/__init__.py?rev=30864&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/zope2install/__init__.py (added)
+++ erp5/trunk/utils/erp5.recipe.zope2install/src/erp5/recipe/zope2install/__init__.py [utf8] Wed Nov 25 22:34:43 2009
@@ -1,0 +1,129 @@
+##############################################################################
+#
+# Copyright (c) 2007 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+#   Contains code from plone.recipe.zope2install
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+import os, shutil, tempfile, urllib2, urlparse
+import setuptools.archive_util
+import plone.recipe.zope2install
+from zc.buildout.buildout import _isurl
+
+class Recipe(plone.recipe.zope2install.Recipe):
+
+    def install(self):
+        options = self.options
+        location = options['location']
+        download_dir = self.buildout['buildout']['download-cache']
+        smart_recompile = options.get('smart-recompile') == 'true'
+
+        if os.path.exists(location):
+            # if the zope installation exists and is shared, then we are done
+            # and don't return a path, so the shared installation doesn't get
+            # deleted on uninstall
+            if options.get('shared-zope') == 'true':
+                # We update the fake eggs in case we have special skips or
+                # additions
+                if self.fake_zope_eggs:
+                    print 'Creating fake eggs'
+                    self.fakeEggs()
+                return []
+        else:
+            smart_recompile = True
+
+        if smart_recompile and os.path.exists(location):
+            # checking if the c source where compiled.
+            if self._compiled(location):
+                if self.fake_zope_eggs:
+                    print 'Creating fake eggs'
+                    self.fakeEggs()
+                return []
+
+        # full installation
+        if os.path.exists(location):
+            shutil.rmtree(location)
+
+        if self.svn:
+            assert os.system('svn co %s %s' % (options['svn'], location)) == 0
+        else:
+            if not os.path.isdir(download_dir):
+                os.mkdir(download_dir)
+
+            _, _, urlpath, _, _, _ = urlparse.urlparse(self.url)
+            tmp = tempfile.mkdtemp('buildout-'+self.name)
+            try:
+                fname = os.path.join(download_dir, urlpath.split('/')[-1])
+                # Have we already downloaded the file
+                if not os.path.exists(fname):
+                    f = open(fname, 'wb')
+                    try:
+                        f.write(urllib2.urlopen(self.url).read())
+                    except:
+                        os.remove(fname)
+                        raise
+                    f.close()
+
+                setuptools.archive_util.unpack_archive(fname, tmp)
+                # The Zope tarballs have a Zope-<version> folder at the root
+                # level, so we need to move that one into the right place.
+                files = os.listdir(tmp)
+                if len(files) == 0:
+                    raise ValueError('Broken Zope tarball named %s' % fname)
+                shutil.move(os.path.join(tmp, files[0]), location)
+            finally:
+                shutil.rmtree(tmp)
+
+        os.chdir(location)
+
+        # erp5 patch begin : apply a patch before building zope
+        patch = options['patch']
+        if _isurl(patch):
+            if not os.path.isdir(download_dir):
+                os.mkdir(download_dir)
+            _, _, urlpath, _, _, _ = urlparse.urlparse(patch)
+            fname = os.path.join(download_dir, urlpath.split('/')[-1])
+            # Have we already downloaded the file
+            if not os.path.exists(fname):
+                f = open(fname, 'wb')
+                try:
+                    f.write(urllib2.urlopen(patch).read())
+                except:
+                    os.remove(fname)
+                    raise
+                f.close()
+            patch = fname
+        assert os.spawnlp(os.P_WAIT, 'patch', 'patch', '-p1', '-i', patch) == 0
+        # erp5 patch end : apply a patch to zope before build
+
+        assert os.spawnl(
+            os.P_WAIT, options['executable'], options['executable'],
+            'setup.py',
+            'build_ext', '-i',
+            ) == 0
+
+        # compile .py files to .pyc;
+        # ignore return status since compilezpy.py will return
+        # an exist status of 1 for even a single failed compile.
+        os.spawnl(
+            os.P_WAIT, options['executable'], options['executable'],
+            os.path.join(location, 'utilities', 'compilezpy.py'),
+            'build_ext', '-i',
+            )
+
+        if self.fake_zope_eggs:
+            print 'Creating fake eggs'
+            self.fakeEggs()
+        if self.url and options.get('shared-zope') == 'true':
+            # don't return path if the installation is shared, so it doesn't
+            # get deleted on uninstall
+            return []
+        return location




More information about the Erp5-report mailing list