[Erp5-report] r31386 kazuhiko - in /erp5/trunk/utils/erp5.recipe.zope2instance: ./ src/erp5...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Dec 18 13:29:12 CET 2009
Author: kazuhiko
Date: Fri Dec 18 13:29:10 2009
New Revision: 31386
URL: http://svn.erp5.org?rev=31386&view=rev
Log:
- Do not delete contents in several directories that can be modified by
business template installation.
Modified:
erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.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=31386&r1=31385&r2=31386&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.zope2instance/CHANGES.txt [utf8] Fri Dec 18 13:29:10 2009
@@ -1,5 +1,12 @@
Changelog
=========
+
+1.2 (2009-12-18)
+----------------
+
+- Do not delete contents in several directories that can be modified by
+ business template installation.
+ [kazuhiko]
1.1 (2009-12-08)
----------------
Modified: erp5/trunk/utils/erp5.recipe.zope2instance/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.zope2instance/setup.py?rev=31386&r1=31385&r2=31386&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.zope2instance/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.zope2instance/setup.py [utf8] Fri Dec 18 13:29:10 2009
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
name = "erp5.recipe.zope2instance"
-version = '1.1'
+version = '1.2'
def read(name):
return open(name).read()
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=31386&r1=31385&r2=31386&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] Fri Dec 18 13:29:10 2009
@@ -2,6 +2,7 @@
##############################################################################
#
# Copyright (c) 2009 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,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
@@ -11,17 +12,59 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-import os, shutil
+import os, shutil, sys
+import zc.buildout
import plone.recipe.zope2instance
class Recipe(plone.recipe.zope2instance.Recipe):
def install(self):
# Override plone.recipe.zope2instance so as to create several
# directories used by ERP5.
- ret = plone.recipe.zope2instance.Recipe.install(self)
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):
+ # patch begin: call self._clean_up instead of shutil.rmtree
+ self._clean_up(location)
+ # patch end: call self._clean_up instead of shutil.rmtree
+
+ # 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
+
+ # patch begin: create several directories and a symlink for ERP5
for directory in ('Constraint', 'Document', 'PropertySheet', 'tests'):
path = os.path.join(location, directory)
if not os.path.exists(path):
@@ -32,5 +75,44 @@
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
- return ret
+ 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()
+
+ # Add zcml files to package-includes
+ self.build_package_includes()
+ except:
+ # clean up
+ if os.path.exists(location):
+ # patch begin: call self._clean_up instead of shutil.rmtree
+ self._clean_up(location)
+ # patch end: call self._clean_up instead of shutil.rmtree
+ raise
+
+ return location
+
+ def _clean_up(self, location):
+ # do not delete contents in several directories that can be
+ # modified by business template installation.
+ for path in os.listdir(location):
+ if path in ('Constraint', 'Document', 'Extensions',
+ 'PropertySheet', 'tests',):
+ pass
+ else:
+ path = os.path.join(location, path)
+ if os.path.isdir(path) and not os.path.islink(path):
+ shutil.rmtree(path)
+ else:
+ os.unlink(path)
More information about the Erp5-report
mailing list