Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Klaus Wölfel
slapos.core
Commits
a2548626
Commit
a2548626
authored
Jan 26, 2012
by
Yingjie Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unused code.
parent
464c50a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
44 deletions
+0
-44
slapos/grid/networkcache.py
slapos/grid/networkcache.py
+0
-44
No files found.
slapos/grid/networkcache.py
View file @
a2548626
...
@@ -35,15 +35,6 @@ except:
...
@@ -35,15 +35,6 @@ except:
LIBNETWORKCACHE_ENABLED
=
False
LIBNETWORKCACHE_ENABLED
=
False
print
'Networkcache forced to be disabled.'
print
'Networkcache forced to be disabled.'
_md5_re
=
re
.
compile
(
r'md5=([a-f0-9]+)'
)
def
_get_md5_from_url
(
url
):
match
=
_md5_re
.
search
(
url
)
if
match
:
return
match
.
group
(
1
)
return
None
def
fallback_call
(
function
):
def
fallback_call
(
function
):
"""Decorator which disallow to have any problem while calling method"""
"""Decorator which disallow to have any problem while calling method"""
def
wrapper
(
self
,
*
args
,
**
kwd
):
def
wrapper
(
self
,
*
args
,
**
kwd
):
...
@@ -60,20 +51,6 @@ def fallback_call(function):
...
@@ -60,20 +51,6 @@ def fallback_call(function):
return
wrapper
return
wrapper
@
fallback_call
def
get_directory_key
(
url
):
"""Returns directory hash based on url.
Basically check if the url belongs to pypi:
- if yes, the directory key will be pypi-buildout-urlmd5
- if not, the directory key will be slapos-buildout-urlmd5
"""
urlmd5
=
hashlib
.
md5
(
url
).
hexdigest
()
if
'pypi'
in
url
:
return
'pypi-buildout-%s'
%
urlmd5
return
'slapos-buildout-%s'
%
urlmd5
@
fallback_call
@
fallback_call
def
download_network_cached
(
dir_url
,
cache_url
,
path
,
url
,
logger
,
def
download_network_cached
(
dir_url
,
cache_url
,
path
,
url
,
logger
,
signature_certificate_list
,
md5sum
=
None
):
signature_certificate_list
,
md5sum
=
None
):
...
@@ -181,24 +158,3 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
...
@@ -181,24 +158,3 @@ def upload_network_cached(dir_url, cache_url, external_url, path, logger,
f
.
close
()
f
.
close
()
return
True
return
True
@
fallback_call
def
get_filename_from_url
(
url
):
"""Inspired how pip get filename from url.
"""
parsed_url
=
urlparse
.
urlparse
(
url
)
if
parsed_url
.
query
and
parsed_url
.
path
.
endswith
(
'/'
):
name
=
parsed_url
.
query
.
split
(
'?'
,
1
)[
0
]
elif
parsed_url
.
path
.
endswith
(
'/'
)
and
not
parsed_url
.
query
:
name
=
parsed_url
.
path
.
split
(
'/'
)[
-
2
]
else
:
name
=
posixpath
.
basename
(
parsed_url
.
path
)
name
=
name
.
split
(
'#'
,
1
)[
0
]
assert
name
,
(
'URL %r produced no filename'
%
url
)
return
name
from
download
import
check_md5sum
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