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
6fd43ee6
Commit
6fd43ee6
authored
May 05, 2011
by
Lucas Carvalho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved fetch_from_network_cache into zc.buildout.easy_install.Installer._fetch.
Signed-off-by:
Lucas Carvalho
<
lucas@nexedi.com
>
parent
771bd6f4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
22 deletions
+9
-22
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+8
-5
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+1
-17
No files found.
src/zc/buildout/easy_install.py
View file @
6fd43ee6
...
@@ -18,8 +18,9 @@ It doesn't install scripts. It uses setuptools and requires it to be
...
@@ -18,8 +18,9 @@ It doesn't install scripts. It uses setuptools and requires it to be
installed.
installed.
"""
"""
from
zc.buildout.networkcache
import
fetch_from_network_cache
,
\
from
zc.buildout.networkcache
import
get_filename_from_url
,
\
upload_network_cached
upload_network_cached
,
\
download_network_cached
import
distutils.errors
import
distutils.errors
import
fnmatch
import
fnmatch
import
glob
import
glob
...
@@ -706,9 +707,11 @@ class Installer:
...
@@ -706,9 +707,11 @@ class Installer:
and
(
realpath
(
os
.
path
.
dirname
(
dist
.
location
))
==
download_cache
)
and
(
realpath
(
os
.
path
.
dirname
(
dist
.
location
))
==
download_cache
)
):
):
return
dist
return
dist
new_location
=
fetch_from_network_cache
(
self
.
_network_cache
,
dist
.
location
,
tmp
,
logger
)
filename
=
get_filename_from_url
(
dist
.
location
)
if
new_location
is
None
:
new_location
=
os
.
path
.
join
(
tmp
,
filename
)
if
not
download_network_cached
(
self
.
_network_cache
,
new_location
,
dist
.
location
,
logger
):
new_location
=
self
.
_index
.
download
(
dist
.
location
,
tmp
)
new_location
=
self
.
_index
.
download
(
dist
.
location
,
tmp
)
upload_network_cached
(
self
.
_network_cache
,
upload_network_cached
(
self
.
_network_cache
,
dist
.
location
,
new_location
,
logger
)
dist
.
location
,
new_location
,
logger
)
...
...
src/zc/buildout/networkcache.py
View file @
6fd43ee6
...
@@ -161,7 +161,7 @@ def upload_network_cached(network_cache, external_url, path, logger):
...
@@ -161,7 +161,7 @@ def upload_network_cached(network_cache, external_url, path, logger):
return
True
return
True
def
_
get_filename_from_url
(
url
):
def
get_filename_from_url
(
url
):
"""Inspired how pip get filename from url.
"""Inspired how pip get filename from url.
"""
"""
url
=
url
.
split
(
'#'
,
1
)[
0
]
url
=
url
.
split
(
'#'
,
1
)[
0
]
...
@@ -171,19 +171,3 @@ def _get_filename_from_url(url):
...
@@ -171,19 +171,3 @@ def _get_filename_from_url(url):
assert
name
,
(
assert
name
,
(
'URL %r produced no filename'
%
url
)
'URL %r produced no filename'
%
url
)
return
name
return
name
def
fetch_from_network_cache
(
network_cache
,
location
,
tmp
,
logger
):
""" Try to download from a network cache and preserve
original filename.
"""
if
network_cache
in
(
None
,
''
):
return
None
filename
=
_get_filename_from_url
(
location
)
path
=
os
.
path
.
join
(
tmp
,
filename
)
is_downloaded
=
download_network_cached
(
network_cache
,
path
,
location
,
logger
)
if
is_downloaded
:
return
path
return
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