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
Xavier Thompson
slapos.buildout
Commits
bd3b9c3b
Commit
bd3b9c3b
authored
Jun 23, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify library existence detection.
parent
5d5ebff6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
11 deletions
+11
-11
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+11
-11
No files found.
src/zc/buildout/networkcache.py
View file @
bd3b9c3b
...
...
@@ -20,6 +20,13 @@ import re
import
urllib
import
urlparse
try
:
from
slapos.libnetworkcache
import
NetworkcacheClient
,
UploadError
,
\
DirectoryNotFound
except
ImportError
:
LIBNETWORKCACHE_ENABLED
=
False
else
:
LIBNETWORKCACHE_ENABLED
=
True
_md5_re
=
re
.
compile
(
r'md5=([a-f0-9]+)'
)
...
...
@@ -52,13 +59,9 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
return True if download succeeded.
"""
try
:
from
slapos.libnetworkcache
import
NetworkcacheClient
,
UploadError
,
\
DirectoryNotFound
except
:
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
if
sha_cache
in
(
None
,
''
,):
# Not able to use network cache
return
False
...
...
@@ -94,10 +97,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
def
upload_network_cached
(
sha_cache
,
sha_dir
,
external_url
,
path
,
logger
):
"""Upload file to a network cache server"""
try
:
from
slapos.libnetworkcache
import
NetworkcacheClient
,
UploadError
,
\
DirectoryNotFound
except
:
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
if
sha_cache
in
[
None
,
''
]
or
sha_dir
in
[
None
,
''
]:
...
...
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