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
104
Merge Requests
104
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
b0585dbd
Commit
b0585dbd
authored
Jun 09, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download is in slapos.recipe.download.
parent
8d9491d0
Changes
3
Show 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 @
b0585dbd
...
@@ -40,7 +40,6 @@ setup(name=name,
...
@@ -40,7 +40,6 @@ setup(name=name,
zip_safe
=
True
,
zip_safe
=
True
,
entry_points
=
{
entry_points
=
{
'zc.buildout'
:
[
'zc.buildout'
:
[
'download = slapos.recipe.download:Recipe'
,
'erp5 = slapos.recipe.erp5:Recipe'
,
'erp5 = slapos.recipe.erp5:Recipe'
,
'erp5testnode = slapos.recipe.erp5testnode:Recipe'
,
'erp5testnode = slapos.recipe.erp5testnode:Recipe'
,
'helloworld = slapos.recipe.helloworld:Recipe'
,
'helloworld = slapos.recipe.helloworld:Recipe'
,
...
...
slapos/recipe/README.download.txt
deleted
100644 → 0
View file @
8d9491d0
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 @
8d9491d0
##############################################################################
#
# 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