Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
103
Merge Requests
103
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
97306dd8
Commit
97306dd8
authored
Sep 05, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Download functionality was moved to slapos.recipe.build
parent
ab2afeaa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
109 deletions
+0
-109
setup.py
setup.py
+0
-1
slapos/recipe/README.download.txt
slapos/recipe/README.download.txt
+0
-36
slapos/recipe/download.py
slapos/recipe/download.py
+0
-72
No files found.
setup.py
View file @
97306dd8
...
...
@@ -39,7 +39,6 @@ setup(name=name,
zip_safe
=
True
,
entry_points
=
{
'zc.buildout'
:
[
'download = slapos.recipe.download:Recipe'
,
'erp5 = slapos.recipe.erp5:Recipe'
,
'erp5testnode = slapos.recipe.erp5testnode:Recipe'
,
'helloworld = slapos.recipe.helloworld:Recipe'
,
...
...
slapos/recipe/README.download.txt
deleted
100644 → 0
View file @
ab2afeaa
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.
slapos/recipe/download.py
deleted
100644 → 0
View file @
ab2afeaa
##############################################################################
#
# 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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment