[Erp5-report] r45228 luke - in /slapos/trunk/recipe: slapos.recipe.download/ slapos.recipe....
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Apr 8 11:32:06 CEST 2011
Author: luke
Date: Fri Apr 8 11:32:05 2011
New Revision: 45228
URL: http://svn.erp5.org?rev=45228&view=rev
Log:
- SlapOS Buildout's recipes useful for software preparation
Added:
slapos/trunk/recipe/slapos.recipe.download/
slapos/trunk/recipe/slapos.recipe.download/CHANGES.txt
slapos/trunk/recipe/slapos.recipe.download/MANIFEST.in
slapos/trunk/recipe/slapos.recipe.download/README.txt
slapos/trunk/recipe/slapos.recipe.download/setup.cfg
slapos/trunk/recipe/slapos.recipe.download/setup.py
slapos/trunk/recipe/slapos.recipe.download/src/
slapos/trunk/recipe/slapos.recipe.download/src/slapos/
slapos/trunk/recipe/slapos.recipe.download/src/slapos/__init__.py
slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/
slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/__init__.py
slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/download/
slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/download/__init__.py
slapos/trunk/recipe/slapos.recipe.template/
slapos/trunk/recipe/slapos.recipe.template/CHANGES.txt
slapos/trunk/recipe/slapos.recipe.template/MANIFEST.in
slapos/trunk/recipe/slapos.recipe.template/README.txt
slapos/trunk/recipe/slapos.recipe.template/setup.cfg
slapos/trunk/recipe/slapos.recipe.template/setup.py
slapos/trunk/recipe/slapos.recipe.template/src/
slapos/trunk/recipe/slapos.recipe.template/src/slapos/
slapos/trunk/recipe/slapos.recipe.template/src/slapos/__init__.py
slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/
slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/__init__.py
slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/template/
slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/template/__init__.py
Added: slapos/trunk/recipe/slapos.recipe.download/CHANGES.txt
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/CHANGES.txt?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/CHANGES.txt (added)
+++ slapos/trunk/recipe/slapos.recipe.download/CHANGES.txt [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,4 @@
+1.0 (unreleased)
+----------------
+
+ - initial release [Łukasz Nowak]
Added: slapos/trunk/recipe/slapos.recipe.download/MANIFEST.in
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/MANIFEST.in?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/MANIFEST.in (added)
+++ slapos/trunk/recipe/slapos.recipe.download/MANIFEST.in [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1 @@
+include CHANGES.txt
Added: slapos/trunk/recipe/slapos.recipe.download/README.txt
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/README.txt?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/README.txt (added)
+++ slapos/trunk/recipe/slapos.recipe.download/README.txt [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,34 @@
+slapos.recipe.download
+======================
+
+Extremely simple recipe to download using zc.buildout download utility.
+
+Usage
+-----
+
+ [buildout]
+ parts =
+ download
+
+ [download]
+ recipe = slapos.recipe.download
+ url = https://some.url/file
+
+Such profile will download https://some.url/file and put it in
+buildout:parts-directory/download/download
+
+filename parameter can be used to change destination named filename.
+
+destination parameter allows to put explicit destination.
+
+md5sum parameter allows pass md5sum.
+
+mode (octal, so for rw-r--r-- use 0644) allows to set mode
+
+Exposes target attribute which is path to downloaded file.
+
+Notes
+-----
+
+This recipe suffers from buildout download utility issue, which will do not
+try to redownload resource with wrong md5sum.
Added: slapos/trunk/recipe/slapos.recipe.download/setup.cfg
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/setup.cfg?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/setup.cfg (added)
+++ slapos/trunk/recipe/slapos.recipe.download/setup.cfg [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,3 @@
+[egg_info]
+tag_build = .dev
+tag_svn_revision = 1
Added: slapos/trunk/recipe/slapos.recipe.download/setup.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/setup.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/setup.py (added)
+++ slapos/trunk/recipe/slapos.recipe.download/setup.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,28 @@
+from setuptools import setup, find_packages
+
+version = '1.0'
+name = 'slapos.recipe.download'
+long_description = open("README.txt").read() + "\n" + \
+ open("CHANGES.txt").read()
+
+setup(name=name,
+ version=version,
+ description="Simple download recipe",
+ long_description=long_description,
+ classifiers=[
+ "Framework :: Buildout :: Recipe",
+ "Programming Language :: Python",
+ ],
+ keywords='slapos download',
+ license='GPLv3',
+ namespace_packages=['slapos'],
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+ include_package_data=True,
+ install_requires=[
+ 'setuptools', # for namespace
+ 'zc.buildout', # needed to play internally
+ ],
+ entry_points={'zc.buildout': ['default = %s:Recipe' % name]},
+ zip_safe=True,
+ )
Added: slapos/trunk/recipe/slapos.recipe.download/src/slapos/__init__.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/src/slapos/__init__.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/src/slapos/__init__.py (added)
+++ slapos/trunk/recipe/slapos.recipe.download/src/slapos/__init__.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,7 @@
+# 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: slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/__init__.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/__init__.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/__init__.py (added)
+++ slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/__init__.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,7 @@
+# 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: slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/download/__init__.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/download/__init__.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/download/__init__.py (added)
+++ slapos/trunk/recipe/slapos.recipe.download/src/slapos/recipe/download/__init__.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,72 @@
+##############################################################################
+#
+# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility 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
+# guarantees 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 3
+# 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.
+#
+##############################################################################
+import os
+import logging
+import shutil
+import zc.buildout
+class Recipe:
+ def __init__(self, buildout, name, options):
+ self.buildout = buildout
+ self.name = name
+ self.options = options
+ self.logger = logging.getLogger(self.name)
+ if 'filename' in self.options and 'destination' in self.options:
+ raise zc.buildout.UserError('Parameters filename and destination are '
+ 'exclusive.')
+ self.parts = None
+ self.destination = self.options.get('destination', None)
+ if self.destination is None:
+ self.parts = os.path.join(self.buildout['buildout']['parts-directory'],
+ self.name)
+ self.destination = os.path.join(self.parts, self.options.get('filename',
+ self.name))
+ options['target'] = self.destination
+
+ def install(self):
+ if self.parts is not None:
+ if not os.path.isdir(self.parts):
+ os.mkdir(self.parts)
+ download = zc.buildout.download.Download(self.buildout['buildout'],
+ hash_name=True)
+ path, is_temp = download(self.options['url'],
+ md5sum=self.options.get('md5sum'))
+ if os.path.exists(self.destination):
+ os.unlink(self.destination)
+ shutil.copy(path, self.destination)
+ mode = self.options.get('mode')
+ if mode is not None:
+ mode = int(mode, 8)
+ os.chmod(self.destination, mode)
+ self.logger.debug('Mode of %r set to 0%o.' % (self.destination, mode))
+ self.logger.debug('Downloaded %r and saved to %r.' % (self.options['url'],
+ self.destination))
+ if self.parts is not None:
+ return [self.parts]
+ else:
+ return []
+
+ update = install
Added: slapos/trunk/recipe/slapos.recipe.template/CHANGES.txt
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/CHANGES.txt?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/CHANGES.txt (added)
+++ slapos/trunk/recipe/slapos.recipe.template/CHANGES.txt [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,4 @@
+1.0 (unreleased)
+----------------
+
+ - initial release [Łukasz Nowak]
Added: slapos/trunk/recipe/slapos.recipe.template/MANIFEST.in
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/MANIFEST.in?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/MANIFEST.in (added)
+++ slapos/trunk/recipe/slapos.recipe.template/MANIFEST.in [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1 @@
+include CHANGES.txt
Added: slapos/trunk/recipe/slapos.recipe.template/README.txt
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/README.txt?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/README.txt (added)
+++ slapos/trunk/recipe/slapos.recipe.template/README.txt [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,22 @@
+slapos.recipe.template
+======================
+
+Fully networked template recipe, reusing collective.recipe.template with
+ability to download template over the network
+
+Usage
+-----
+
+ [buildout]
+ parts = template
+
+ [template]
+ recipe = slapos.recipe.template
+ url = http://server/with/template
+ # optional md5sum
+ md5sum = 1234567890
+ output = ${buildout:directory}/result
+
+All parameters except url and md5sum will be passed to
+collective.recipe.template, so please visit
+http://pypi.python.org/pypi/collective.recipe.template for full information.
Added: slapos/trunk/recipe/slapos.recipe.template/setup.cfg
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/setup.cfg?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/setup.cfg (added)
+++ slapos/trunk/recipe/slapos.recipe.template/setup.cfg [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,3 @@
+[egg_info]
+tag_build = .dev
+tag_svn_revision = 1
Added: slapos/trunk/recipe/slapos.recipe.template/setup.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/setup.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/setup.py (added)
+++ slapos/trunk/recipe/slapos.recipe.template/setup.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,29 @@
+from setuptools import setup, find_packages
+
+version = '1.0'
+name = 'slapos.recipe.template'
+long_description = open("README.txt").read() + "\n" + \
+ open("CHANGES.txt").read()
+
+setup(name=name,
+ version=version,
+ description="collective.recipe.template with network input support",
+ long_description=long_description,
+ classifiers=[
+ "Framework :: Buildout :: Recipe",
+ "Programming Language :: Python",
+ ],
+ keywords='slapos download',
+ license='GPLv3',
+ namespace_packages=['slapos'],
+ packages=find_packages('src'),
+ package_dir={'': 'src'},
+ include_package_data=True,
+ install_requires=[
+ 'collective.recipe.template', # used for real run
+ 'setuptools', # for namespace
+ 'zc.buildout', # needed to play internally
+ ],
+ entry_points={'zc.buildout': ['default = %s:Recipe' % name]},
+ zip_safe=True,
+ )
Added: slapos/trunk/recipe/slapos.recipe.template/src/slapos/__init__.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/src/slapos/__init__.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/src/slapos/__init__.py (added)
+++ slapos/trunk/recipe/slapos.recipe.template/src/slapos/__init__.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,7 @@
+# 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: slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/__init__.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/__init__.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/__init__.py (added)
+++ slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/__init__.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,7 @@
+# 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: slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/template/__init__.py
URL: http://svn.erp5.org/slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/template/__init__.py?rev=45228&view=auto
==============================================================================
--- slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/template/__init__.py (added)
+++ slapos/trunk/recipe/slapos.recipe.template/src/slapos/recipe/template/__init__.py [utf8] Fri Apr 8 11:32:05 2011
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsibility 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
+# guarantees 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 3
+# 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.
+#
+##############################################################################
+
+import collective.recipe.template
+import zc.buildout
+class Recipe(collective.recipe.template.Recipe):
+ def __init__(self, buildout, name, options):
+ download = zc.buildout.download.Download(buildout['buildout'],
+ hash_name=True)
+ path, is_temp = download(options.pop('url'),
+ md5sum=options.get('md5sum'))
+ options['input'] = path
+ collective.recipe.template.Recipe.__init__(self, buildout, name, options)
More information about the Erp5-report
mailing list