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
isaak yansane-sisk
slapos.buildout
Commits
ca0599e3
Commit
ca0599e3
authored
May 06, 2011
by
Lucas Carvalho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed useless import.
parent
ce3baeea
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
src/zc/buildout/download.py
src/zc/buildout/download.py
+17
-20
No files found.
src/zc/buildout/download.py
View file @
ca0599e3
...
@@ -40,8 +40,7 @@ class ChecksumError(zc.buildout.UserError):
...
@@ -40,8 +40,7 @@ class ChecksumError(zc.buildout.UserError):
url_opener
=
URLOpener
()
url_opener
=
URLOpener
()
from
zc.buildout.networkcache
import
get_sha256sum_from_networkcached
,
\
from
zc.buildout.networkcache
import
download_network_cached
,
\
download_network_cached
,
\
upload_network_cached
upload_network_cached
...
@@ -180,27 +179,25 @@ class Download(object):
...
@@ -180,27 +179,25 @@ class Download(object):
self
.
logger
.
info
(
'Downloading %s'
%
url
)
self
.
logger
.
info
(
'Downloading %s'
%
url
)
urllib
.
_urlopener
=
url_opener
urllib
.
_urlopener
=
url_opener
handle
,
tmp_path
=
tempfile
.
mkstemp
(
prefix
=
'buildout-'
)
handle
,
tmp_path
=
tempfile
.
mkstemp
(
prefix
=
'buildout-'
)
try
:
try
:
if
not
download_network_cached
(
self
.
network_cache
,
tmp_path
,
try
:
url
,
self
.
logger
):
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
)
# Download from original url
if
not
check_md5sum
(
tmp_path
,
md5sum
):
tmp_path
,
headers
=
urllib
.
urlretrieve
(
url
,
tmp_path
)
raise
ChecksumError
(
if
not
check_md5sum
(
tmp_path
,
md5sum
):
'MD5 checksum mismatch downloading %r'
%
url
)
raise
ChecksumError
(
# Upload the file to networkcached.
'MD5 checksum mismatch downloading %r'
%
url
)
upload_network_cached
(
self
.
network_cache
,
url
,
# Upload the file to networkcached.
tmp_path
,
self
.
logger
)
upload_network_cached
(
self
.
network_cache
,
url
,
except
IOError
,
e
:
tmp_path
,
self
.
logger
)
os
.
remove
(
tmp_path
)
finally
:
raise
zc
.
buildout
.
UserError
(
"Error downloading extends for URL "
os
.
close
(
handle
)
"%s: %r"
%
(
url
,
e
[
1
:
3
]))
except
:
except
Exception
,
e
:
os
.
remove
(
tmp_path
)
os
.
remove
(
tmp_path
)
raise
raise
finally
:
os
.
close
(
handle
)
if
path
:
if
path
:
shutil
.
move
(
tmp_path
,
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