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
Boxiang Sun
slapos.buildout
Commits
73b544e5
Commit
73b544e5
authored
Jun 23, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove specific cache naming.
parent
37efda8d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
27 deletions
+27
-27
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+6
-6
src/zc/buildout/download.py
src/zc/buildout/download.py
+4
-4
src/zc/buildout/easy_install.py
src/zc/buildout/easy_install.py
+8
-8
src/zc/buildout/networkcache.py
src/zc/buildout/networkcache.py
+7
-7
zc.recipe.egg_/src/zc/recipe/egg/egg.py
zc.recipe.egg_/src/zc/recipe/egg/egg.py
+2
-2
No files found.
src/zc/buildout/buildout.py
View file @
73b544e5
...
...
@@ -396,8 +396,8 @@ class Buildout(UserDict.DictMixin):
newest
=
self
.
newest
,
allow_hosts
=
self
.
_allow_hosts
,
prefer_final
=
not
self
.
accept_buildout_test_releases
,
sha_cache
=
self
.
download_cache_url
,
sha_dir
=
self
.
download_dir_url
,
download_cache_url
=
self
.
download_cache_url
,
download_dir_url
=
self
.
download_dir_url
,
)
# Now copy buildout and setuptools eggs, and record destination eggs:
...
...
@@ -899,8 +899,8 @@ class Buildout(UserDict.DictMixin):
path
=
[
options
[
'develop-eggs-directory'
]],
allow_hosts
=
self
.
_allow_hosts
,
prefer_final
=
not
self
.
accept_buildout_test_releases
,
sha_cache
=
self
.
download_cache_url
,
sha_dir
=
self
.
download_dir_url
,
download_cache_url
=
self
.
download_cache_url
,
download_dir_url
=
self
.
download_dir_url
,
)
upgraded
=
[]
...
...
@@ -1129,8 +1129,8 @@ def _install_and_load(spec, group, entry, buildout):
newest
=
buildout
.
newest
,
allow_hosts
=
buildout
.
_allow_hosts
,
prefer_final
=
not
buildout
.
accept_buildout_test_releases
,
sha_cache
=
self
.
download_cache_url
,
sha_dir
=
self
.
download_dir_url
)
download_cache_url
=
self
.
download_cache_url
,
download_dir_url
=
self
.
download_dir_url
)
__doing__
=
'Loading %s recipe entry %s:%s.'
,
group
,
spec
,
entry
return
pkg_resources
.
load_entry_point
(
...
...
src/zc/buildout/download.py
View file @
73b544e5
...
...
@@ -71,8 +71,8 @@ class Download(object):
self
.
fallback
=
fallback
self
.
hash_name
=
hash_name
self
.
logger
=
logger
or
logging
.
getLogger
(
'zc.buildout'
)
self
.
sha_dir
=
options
.
get
(
'sha-dir'
)
self
.
sha_cache
=
options
.
get
(
'sha-cache'
)
self
.
download_dir_url
=
options
.
get
(
'sha-dir'
)
self
.
download_cache_url
=
options
.
get
(
'sha-cache'
)
@
property
def
download_cache
(
self
):
...
...
@@ -178,7 +178,7 @@ class Download(object):
try
:
try
:
if
not
download_network_cached
(
self
.
sha_dir
,
self
.
sha_cache
,
if
not
download_network_cached
(
self
.
download_dir_url
,
self
.
download_cache_url
,
tmp_path
,
url
,
self
.
logger
,
md5sum
):
# Download from original url
...
...
@@ -187,7 +187,7 @@ class Download(object):
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
# Upload the file to networkcached.
upload_network_cached
(
self
.
sha_cache
,
self
.
sha_dir
,
url
,
upload_network_cached
(
self
.
download_cache_url
,
self
.
download_dir_url
,
url
,
tmp_path
,
self
.
logger
)
finally
:
os
.
close
(
handle
)
...
...
src/zc/buildout/easy_install.py
View file @
73b544e5
...
...
@@ -341,8 +341,8 @@ class Installer:
include_site_packages
=
None
,
allowed_eggs_from_site_packages
=
None
,
prefer_final
=
None
,
sha_dir
=
None
,
sha_cache
=
None
download_dir_url
=
None
,
download_cache_url
=
None
):
self
.
_dest
=
dest
self
.
_allow_hosts
=
allow_hosts
...
...
@@ -411,8 +411,8 @@ class Installer:
if
versions
is
not
None
:
self
.
_versions
=
versions
self
.
_
sha_dir
=
sha_dir
self
.
_
sha_cache
=
sha_cache
self
.
_
download_dir_url
=
download_dir_url
self
.
_
download_cache_url
=
download_cache_url
_allowed_eggs_from_site_packages_regex
=
None
def
allow_site_package_egg
(
self
,
name
):
...
...
@@ -715,10 +715,10 @@ class Installer:
filename
=
get_filename_from_url
(
dist
.
location
)
new_location
=
os
.
path
.
join
(
tmp
,
filename
)
if
not
download_network_cached
(
self
.
_
sha_dir
,
self
.
_sha_cache
,
if
not
download_network_cached
(
self
.
_
download_dir_url
,
self
.
_download_cache_url
,
new_location
,
dist
.
location
,
logger
):
new_location
=
self
.
_index
.
download
(
dist
.
location
,
tmp
)
upload_network_cached
(
self
.
_
sha_cache
,
self
.
_sha_dir
,
upload_network_cached
(
self
.
_
download_cache_url
,
self
.
_download_dir_url
,
dist
.
location
,
new_location
,
logger
)
if
(
download_cache
...
...
@@ -1098,13 +1098,13 @@ def install(specs, dest,
path
=
None
,
working_set
=
None
,
newest
=
True
,
versions
=
None
,
use_dependency_links
=
None
,
allow_hosts
=
(
'*'
,),
include_site_packages
=
None
,
allowed_eggs_from_site_packages
=
None
,
prefer_final
=
None
,
sha_dir
=
None
,
sha_cache
=
None
):
prefer_final
=
None
,
download_dir_url
=
None
,
download_cache_url
=
None
):
installer
=
Installer
(
dest
,
links
,
index
,
executable
,
always_unzip
,
path
,
newest
,
versions
,
use_dependency_links
,
allow_hosts
=
allow_hosts
,
include_site_packages
=
include_site_packages
,
allowed_eggs_from_site_packages
=
allowed_eggs_from_site_packages
,
prefer_final
=
prefer_final
,
sha_dir
=
sha_dir
,
sha_cache
=
sha_cache
)
prefer_final
=
prefer_final
,
download_dir_url
=
download_dir_url
,
download_cache_url
=
download_cache_url
)
return
installer
.
install
(
specs
,
working_set
)
...
...
src/zc/buildout/networkcache.py
View file @
73b544e5
...
...
@@ -51,7 +51,7 @@ def get_directory_key(url):
return
'slapos-buildout-%s'
%
urlmd5
def
download_network_cached
(
sha_dir
,
sha_cache
,
path
,
url
,
logger
,
md5sum
=
None
):
def
download_network_cached
(
download_dir_url
,
download_cache_url
,
path
,
url
,
logger
,
md5sum
=
None
):
"""Downloads from a network cache provider
If something fail (providor be offline, or hash_string fail), we ignore
...
...
@@ -62,7 +62,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
if
sha_cache
in
(
None
,
''
,):
if
download_cache_url
in
(
None
,
''
,):
# Not able to use network cache
return
False
if
md5sum
is
None
:
...
...
@@ -74,7 +74,7 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
logger
.
info
(
'Downloading %s from network cache.'
%
file_name
)
try
:
nc
=
NetworkcacheClient
(
shacache
=
sha_cache
,
shadir
=
sha_dir
)
nc
=
NetworkcacheClient
(
shacache
=
download_cache_url
,
shadir
=
download_dir_url
)
file_content
=
nc
.
select
(
directory_key
)
f
=
open
(
path
,
'w+b'
)
...
...
@@ -95,12 +95,12 @@ def download_network_cached(sha_dir, sha_cache, path, url, logger, md5sum=None):
return
True
def
upload_network_cached
(
sha_cache
,
sha_dir
,
external_url
,
path
,
logger
):
def
upload_network_cached
(
download_cache_url
,
download_dir_url
,
external_url
,
path
,
logger
):
"""Upload file to a network cache server"""
if
not
LIBNETWORKCACHE_ENABLED
:
return
False
if
sha_cache
in
[
None
,
''
]
or
sha_dir
in
[
None
,
''
]:
if
download_cache_url
in
[
None
,
''
]
or
download_dir_url
in
[
None
,
''
]:
logger
.
debug
(
'Upload cache ignored, shacache or shadir was not provided!'
)
return
False
...
...
@@ -112,8 +112,8 @@ def upload_network_cached(sha_cache, sha_dir, external_url, path, logger):
f
=
open
(
path
,
'r'
)
try
:
nc
=
NetworkcacheClient
(
shacache
=
sha_cache
,
shadir
=
sha_dir
)
nc
=
NetworkcacheClient
(
shacache
=
download_cache_url
,
shadir
=
download_dir_url
)
data
=
nc
.
upload
(
f
,
directory_key
,
**
kw
)
except
(
IOError
,
UploadError
),
e
:
logger
.
info
(
'Fail to upload file. %s'
%
\
...
...
zc.recipe.egg_/src/zc/recipe/egg/egg.py
View file @
73b544e5
...
...
@@ -89,9 +89,9 @@ class Eggs(object):
if
'unzip'
in
options
:
kw
[
'always_unzip'
]
=
options
.
query_bool
(
'unzip'
,
None
)
if
'sha-cache'
in
b_options
:
kw
[
'
sha_cache
'
]
=
b_options
.
get
(
'sha-cache'
)
kw
[
'
download_cache_url
'
]
=
b_options
.
get
(
'sha-cache'
)
if
'sha-dir'
in
b_options
:
kw
[
'
sha_dir
'
]
=
b_options
.
get
(
'sha-dir'
)
kw
[
'
download_dir_url
'
]
=
b_options
.
get
(
'sha-dir'
)
ws
=
zc
.
buildout
.
easy_install
.
install
(
distributions
,
options
[
'eggs-directory'
],
...
...
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