Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.buildout
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Rafael Monnerat
slapos.buildout
Commits
ce3baeea
Commit
ce3baeea
authored
May 06, 2011
by
Lucas Carvalho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore some code from original version which has been removed accidentally by someone.
parent
6047dbd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
16 deletions
+18
-16
src/zc/buildout/download.py
src/zc/buildout/download.py
+18
-16
No files found.
src/zc/buildout/download.py
View file @
ce3baeea
...
...
@@ -180,25 +180,27 @@ class Download(object):
self
.
logger
.
info
(
'Downloading %s'
%
url
)
urllib
.
_urlopener
=
url_opener
handle
,
tmp_path
=
tempfile
.
mkstemp
(
prefix
=
'buildout-'
)
try
:
try
:
if
not
download_network_cached
(
self
.
network_cache
,
tmp_path
,
url
,
self
.
logger
):
# Download from original url
tmp_path
,
headers
=
urllib
.
urlretrieve
(
url
,
tmp_path
)
if
not
check_md5sum
(
tmp_path
,
md5sum
):
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
# Upload the file to networkcached.
upload_network_cached
(
self
.
network_cache
,
url
,
tmp_path
,
self
.
logger
)
finally
:
os
.
close
(
handle
)
except
:
if
not
download_network_cached
(
self
.
network_cache
,
tmp_path
,
url
,
self
.
logger
):
# Download from original url
tmp_path
,
headers
=
urllib
.
urlretrieve
(
url
,
tmp_path
)
if
not
check_md5sum
(
tmp_path
,
md5sum
):
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
# Upload the file to networkcached.
upload_network_cached
(
self
.
network_cache
,
url
,
tmp_path
,
self
.
logger
)
except
IOError
,
e
:
os
.
remove
(
tmp_path
)
raise
zc
.
buildout
.
UserError
(
"Error downloading extends for URL "
"%s: %r"
%
(
url
,
e
[
1
:
3
]))
except
Exception
,
e
:
os
.
remove
(
tmp_path
)
raise
finally
:
os
.
close
(
handle
)
if
path
:
shutil
.
move
(
tmp_path
,
path
)
...
...
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