Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Smelkov
slapos
Commits
d0aebea0
Commit
d0aebea0
authored
Feb 21, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add download helper function in librecipe.
parent
2289a403
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
4 deletions
+28
-4
slapos/recipe/librecipe/generic.py
slapos/recipe/librecipe/generic.py
+27
-4
stack/slapos.cfg
stack/slapos.cfg
+1
-0
No files found.
slapos/recipe/librecipe/generic.py
View file @
d0aebea0
...
@@ -32,6 +32,7 @@ import os
...
@@ -32,6 +32,7 @@ import os
import
sys
import
sys
import
inspect
import
inspect
import
re
import
re
import
shutil
import
urllib
import
urllib
import
urlparse
import
urlparse
...
@@ -55,16 +56,16 @@ class GenericBaseRecipe(object):
...
@@ -55,16 +56,16 @@ class GenericBaseRecipe(object):
self
.
buildout
=
buildout
self
.
buildout
=
buildout
self
.
logger
=
logging
.
getLogger
(
name
)
self
.
logger
=
logging
.
getLogger
(
name
)
if
not
options
.
get
(
'location'
):
options
[
'location'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
self
.
options
=
options
.
copy
()
# If _options use self.optionIsTrue
self
.
options
=
options
.
copy
()
# If _options use self.optionIsTrue
self
.
_options
(
options
)
# Options Hook
self
.
_options
(
options
)
# Options Hook
self
.
options
=
options
.
copy
()
# Updated options dict
self
.
options
=
options
.
copy
()
# Updated options dict
self
.
_ws
=
self
.
getWorkingSet
()
self
.
_ws
=
self
.
getWorkingSet
()
if
not
options
.
get
(
'location'
):
options
[
'location'
]
=
os
.
path
.
join
(
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
def
update
(
self
):
def
update
(
self
):
"""By default update method does the same thing than install"""
"""By default update method does the same thing than install"""
return
self
.
install
()
return
self
.
install
()
...
@@ -235,3 +236,25 @@ class GenericBaseRecipe(object):
...
@@ -235,3 +236,25 @@ class GenericBaseRecipe(object):
if
not
self
.
options
.
get
(
'location'
):
if
not
self
.
options
.
get
(
'location'
):
self
.
options
[
'location'
]
=
os
.
path
.
join
(
self
.
options
[
'location'
]
=
os
.
path
.
join
(
self
.
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
self
.
buildout
[
'buildout'
][
'parts-directory'
],
self
.
name
)
def
download
(
self
,
destination
=
None
):
""" A simple wrapper around h.r.download, downloading to self.location"""
self
.
setLocationOption
()
import
hexagonit.recipe.download
if
not
destination
:
destination
=
self
.
location
if
os
.
path
.
exists
(
destination
):
# leftovers from a previous failed attempt, removing it.
log
.
warning
(
'Removing already existing directory %s'
%
destination
)
shutil
.
rmtree
(
destination
)
os
.
mkdir
(
destination
)
try
:
options
=
self
.
options
.
copy
()
options
[
'destination'
]
=
destination
hexagonit
.
recipe
.
download
.
Recipe
(
self
.
buildout
,
self
.
name
,
options
).
install
()
except
:
shutil
.
rmtree
(
destination
)
raise
stack/slapos.cfg
View file @
d0aebea0
...
@@ -60,6 +60,7 @@ recipe = zc.recipe.egg
...
@@ -60,6 +60,7 @@ recipe = zc.recipe.egg
eggs =
eggs =
${lxml-python:egg}
${lxml-python:egg}
slapos.cookbook
slapos.cookbook
hexagonit.recipe.download
inotifyx
inotifyx
netaddr
netaddr
slapos.core
slapos.core
...
...
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