[Erp5-report] r42990 rafael - in /erp5/trunk/utils/erp5.recipe.btrepository: ./ src/erp5/re...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Feb 3 15:49:59 CET 2011
Author: rafael
Date: Thu Feb 3 15:49:59 2011
New Revision: 42990
URL: http://svn.erp5.org?rev=42990&view=rev
Log:
Implement auto-build.
Use erp5.utils.dists and simplify repository and builder.
Update tests.
Removed:
erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/repository.py
Modified:
erp5/trunk/utils/erp5.recipe.btrepository/README.txt
erp5/trunk/utils/erp5.recipe.btrepository/setup.py
erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/__init__.py
erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/doctest.txt
Modified: erp5/trunk/utils/erp5.recipe.btrepository/README.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.btrepository/README.txt?rev=42990&r1=42989&r2=42990&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.btrepository/README.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.btrepository/README.txt [utf8] Thu Feb 3 15:49:59 2011
@@ -3,9 +3,7 @@ Build your Business Template Repository
This recipe is used to create ERP5 business templates repositories. Each
repository is compiled from a URL with uncompress business templates on it.
-This implementation still quite experimental and in future we are going to
-split this eggs into 2: erp5.recipe.btrepository and erp5.bt5 or
-erp5.bt5repository.
+This implementation still quite experimental.
Example
====================
@@ -34,6 +32,7 @@ download-command (Optional)
download-command-extra (Optional)
Additional string appended to download-command. Usefull to define revision.
+ Tip: Use "-r XXXXX" to set specific revision.
preserve-download (Optional)
@@ -43,11 +42,10 @@ preserve-download (Optional)
location (Optional)
Define alternative location to place your repository.
+ Default is into parts/PARTNAME
-auto-run (Optional)
+auto-build (Optional) 0 or 1
Define if buildout automatically launch business template download and
- compress; or only generate update script for manually run.
-
-
-
+ compress automatically or only generate update script for manually run.
+ Default is 0.
Modified: erp5/trunk/utils/erp5.recipe.btrepository/setup.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.btrepository/setup.py?rev=42990&r1=42989&r2=42990&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.btrepository/setup.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.btrepository/setup.py [utf8] Thu Feb 3 15:49:59 2011
@@ -24,7 +24,7 @@ setup(
keywords = "bt5 erp5 buildout",
classifiers = [
"License :: OSI Approved :: Zope Public License",
- "Framework :: Buildout",
+ "Framework :: Buildout :: Recipe",
],
package_dir = {'': 'src'},
Modified: erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/__init__.py?rev=42990&r1=42989&r2=42990&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/__init__.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/__init__.py [utf8] Thu Feb 3 15:49:59 2011
@@ -27,12 +27,10 @@
##############################################################################
import os
-from string import Template
import logging
import zc.buildout
import zc.buildout.easy_install
import zc.recipe.egg
-import ConfigParser
class Recipe(object):
def __init__(self, buildout, name, options):
@@ -51,6 +49,13 @@ class Recipe(object):
options.setdefault("download_folder",
"%s__download__" % options.get('location'))
options.setdefault("preserve-download", "1")
+ options.setdefault("auto-build", "0")
+
+ def _get_download_command(self):
+ """ Build appropriate download command"""
+ options = self.options
+ return " ".join([options.get("download-command"),
+ options.get("download-command-extra")])
def install_script(self):
""" Create default scripts
@@ -59,10 +64,8 @@ class Recipe(object):
url = options.get("url")
requirements, ws = self.egg.working_set(['erp5.recipe.btrepository'])
script_name = "%s_update" % self.name
- download_command = " ".join([options.get("download-command"),
- options.get("download-command-extra")])
scripts = zc.buildout.easy_install.scripts(
- [(script_name,'erp5.recipe.btrepository.repository', 'main')],
+ [(script_name,'erp5.recipe.btrepository', 'builder')],
ws, options['executable'], "bin",
arguments = ("\n url_list = %s , "
"\n destination = '%s' ,"
@@ -72,7 +75,7 @@ class Recipe(object):
url.split(),
options.get('location'),
options.get("download_folder"),
- download_command,
+ self._get_download_command(),
int(options.get("preserve-download")))))
def install(self):
@@ -80,6 +83,25 @@ class Recipe(object):
if not os.path.exists(options.get("location")):
os.mkdir(options.get("location"))
self.install_script()
+ if int(options.get("auto-build")):
+ builder(options.get("url").split(),
+ options.get('location'),
+ options.get("download_folder"),
+ self._get_download_command(),
+ int(options.get("preserve-download")))
return []
update = install
+
+def builder(url_list, destination, download_dir, download_cmd, preserve_download):
+ """ Wrapper to use erp5.utils.dists API from a script
+ created by buildout.
+ """
+ from erp5.utils.dists import repository
+ return repository.build(
+ url_list,
+ destination,
+ download_dir,
+ download_cmd,
+ preserve_download)
+
Modified: erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/doctest.txt
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/doctest.txt?rev=42990&r1=42989&r2=42990&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/doctest.txt [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/doctest.txt [utf8] Thu Feb 3 15:49:59 2011
@@ -29,10 +29,10 @@ sys.path[0:0] = [
]
<BLANKLINE>
<BLANKLINE>
-import erp5.recipe.btrepository.repository
+import erp5.recipe.btrepository
<BLANKLINE>
if __name__ == '__main__':
- erp5.recipe.btrepository.repository.main(
+ erp5.recipe.btrepository.builder(
url_list = ['https://svn.erp5.org/repos/public/erp5/trunk/products/ERP5/bootstrap/', 'https://svn.erp5.org/repos/public/erp5/trunk/bt5'] ,
destination = '/sample-buildout/parts/bt5' ,
download_dir = '/sample-buildout/parts/bt5__download__',
Removed: erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/repository.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/repository.py?rev=42989&view=auto
==============================================================================
--- erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/repository.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.btrepository/src/erp5/recipe/btrepository/repository.py (removed)
@@ -1,38 +0,0 @@
-#! /usr/bin/python
-##############################################################################
-#
-# Copyright (c) 2010 Nexedi SA and Contributors. All Rights Reserved.
-# Rafael Monnerat <rafael at nexedi.com>
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-from erp5.utils.dists import repository
-
-def main(url_list, destination, download_dir, download_cmd, preserve_download):
- return repository.build(
- url_list,
- destination,
- download_dir,
- download_cmd,
- preserve_download)
More information about the Erp5-report
mailing list