[Erp5-report] r26087 - in /experimental/erp5.buildout: profiles/ recipes/

nobody at svn.erp5.org nobody at svn.erp5.org
Wed Mar 18 11:41:49 CET 2009


Author: jerome
Date: Wed Mar 18 11:41:45 2009
New Revision: 26087

URL: http://svn.erp5.org?rev=26087&view=rev
Log:
add a recipe to create a bt5list from business templates downloaded in an
infrae.subversion section

Added:
    experimental/erp5.buildout/recipes/genbt5list.py
Modified:
    experimental/erp5.buildout/profiles/create-site.cfg
    experimental/erp5.buildout/recipes/setup.py

Modified: experimental/erp5.buildout/profiles/create-site.cfg
URL: http://svn.erp5.org/experimental/erp5.buildout/profiles/create-site.cfg?rev=26087&r1=26086&r2=26087&view=diff
==============================================================================
--- experimental/erp5.buildout/profiles/create-site.cfg [utf8] (original)
+++ experimental/erp5.buildout/profiles/create-site.cfg [utf8] Wed Mar 18 11:41:45 2009
@@ -68,3 +68,9 @@
    erp5_l10n_pl_PL
    erp5_l10n_pt-BR
 
+[bt5list]
+recipe = recipes:genbt5list
+bt5_base = ${download_bt5:location}
+bt5_urls = ${download_bt5:urls}
+genbt5list = ${products-erp5:location}/ERP5/bin/genbt5list
+

Added: experimental/erp5.buildout/recipes/genbt5list.py
URL: http://svn.erp5.org/experimental/erp5.buildout/recipes/genbt5list.py?rev=26087&view=auto
==============================================================================
--- experimental/erp5.buildout/recipes/genbt5list.py (added)
+++ experimental/erp5.buildout/recipes/genbt5list.py [utf8] Wed Mar 18 11:41:45 2009
@@ -1,0 +1,54 @@
+import os
+import tarfile
+import logging
+import shutil
+
+import zc.buildout
+
+class Recipe(object):
+    
+    def __init__(self, buildout, name, options):
+        self.buildout, self.options, self.name = buildout, options, name
+        self.logger=logging.getLogger(self.name)
+
+        options.setdefault('executable',
+            self.buildout['buildout']['executable'])
+
+        options['location'] = os.path.join(
+            buildout['buildout']['parts-directory'],
+            self.name,
+            )
+
+
+    def install(self):
+        options = self.options
+        location = options['location']
+
+        if os.path.exists(location):
+            shutil.rmtree(location)
+        os.mkdir(location)
+
+        base = options['bt5_base']
+        for url in options.get('bt5_urls', '').splitlines():
+            if not url:
+                continue
+            url_base, bt5 = url.split()
+            if bt5[-1] == '/':
+                bt5 = bt5[:-1]
+            self.logger.info("Creating bt5 %s" % bt5)
+            tarbt5 = tarfile.open(
+                  os.path.join(location, '%s.bt5' % bt5), 'w:gz')
+            tarbt5.add(os.path.join(base, bt5), arcname=bt5)
+            tarbt5.close()
+
+        os.chdir(location)
+        self.logger.info("Generating bt5list")
+        assert os.spawnl(
+                  os.P_WAIT, os.path.normpath(options['executable']),
+                  zc.buildout.easy_install._safe_arg(options['executable']),
+                  zc.buildout.easy_install._safe_arg(options['genbt5list']),
+                ) == 0
+        
+        return location
+
+

Modified: experimental/erp5.buildout/recipes/setup.py
URL: http://svn.erp5.org/experimental/erp5.buildout/recipes/setup.py?rev=26087&r1=26086&r2=26087&view=diff
==============================================================================
--- experimental/erp5.buildout/recipes/setup.py [utf8] (original)
+++ experimental/erp5.buildout/recipes/setup.py [utf8] Wed Mar 18 11:41:45 2009
@@ -4,6 +4,7 @@
       version="0.0.1",
       entry_points={'zc.buildout': ['zope2install = zope2install:Recipe',
                             'create_erp5_site = create_erp5_site:Recipe',
+                            'genbt5list = genbt5list:Recipe',
                             'run_unit_test = run_unit_test:Recipe']},
       install_requires=['plone.recipe.zope2install',], )
 




More information about the Erp5-report mailing list