diff --git a/setup.py b/setup.py index 1f0917bad3e9bb2ebeb1634b9e83b9b87056968e..5c20d35e3815b8685a51749a61c5c1d1ada181a6 100644 --- a/setup.py +++ b/setup.py @@ -43,7 +43,6 @@ setup(name=name, 'certificate_authority.request = slapos.recipe.certificate_authority:Request', 'cron = slapos.recipe.dcron:Recipe', 'cron.d = slapos.recipe.dcron:Part', - 'download = slapos.recipe.download:Recipe', 'davstorage = slapos.recipe.davstorage:Recipe', 'duplicity = slapos.recipe.duplicity:Recipe', 'erp5 = slapos.recipe.erp5:Recipe', diff --git a/slapos/recipe/README.download.txt b/slapos/recipe/README.download.txt deleted file mode 100644 index a74c946c5cad90d54a1a8b7a8541c8b9bb4687b5..0000000000000000000000000000000000000000 --- a/slapos/recipe/README.download.txt +++ /dev/null @@ -1,36 +0,0 @@ -download -======== - -Extremely simple recipe to download using zc.buildout download utility. - -Usage ------ - -:: - - [buildout] - parts = - download - - [download] - recipe = slapos.cookbook: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. diff --git a/slapos/recipe/download.py b/slapos/recipe/download.py deleted file mode 100644 index e5a602a77fd7341d27d2136ab6f9482f4bf4935f..0000000000000000000000000000000000000000 --- a/slapos/recipe/download.py +++ /dev/null @@ -1,72 +0,0 @@ -############################################################################## -# -# 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