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
78c58c2b
Commit
78c58c2b
authored
Aug 13, 2009
by
Sebastian Wehrmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Restore compatibility to Windows XP and Python2.4.
parent
6278119a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
19 deletions
+35
-19
src/zc/buildout/buildout.py
src/zc/buildout/buildout.py
+4
-2
src/zc/buildout/download.py
src/zc/buildout/download.py
+25
-11
src/zc/buildout/download.txt
src/zc/buildout/download.txt
+5
-5
src/zc/buildout/tests.py
src/zc/buildout/tests.py
+1
-1
No files found.
src/zc/buildout/buildout.py
View file @
78c58c2b
...
...
@@ -1262,7 +1262,8 @@ def _open(base, filename, seen, dl_options, override):
if
filename
in
seen
:
if
is_temp
:
os
.
unlink
(
path
)
fp
.
close
()
os
.
remove
(
path
)
raise
zc
.
buildout
.
UserError
(
"Recursive file include"
,
seen
,
filename
)
root_config_file
=
not
seen
...
...
@@ -1274,7 +1275,8 @@ def _open(base, filename, seen, dl_options, override):
parser
.
optionxform
=
lambda
s
:
s
parser
.
readfp
(
fp
)
if
is_temp
:
os
.
unlink
(
path
)
fp
.
close
()
os
.
remove
(
path
)
extends
=
extended_by
=
None
for
section
in
parser
.
sections
():
...
...
src/zc/buildout/download.py
View file @
78c58c2b
...
...
@@ -21,6 +21,7 @@ from zc.buildout.easy_install import realpath
import
logging
import
os
import
os.path
import
re
import
shutil
import
tempfile
import
urllib
...
...
@@ -148,6 +149,8 @@ class Download(object):
returned and the client code is responsible for cleaning it up.
"""
if
re
.
match
(
r"^[A-Za-z]:\\"
,
url
):
url
=
'file:'
+
url
parsed_url
=
urlparse
.
urlparse
(
url
,
'file'
)
url_scheme
,
_
,
url_path
=
parsed_url
[:
3
]
if
url_scheme
==
'file'
:
...
...
@@ -171,11 +174,11 @@ class Download(object):
if
not
check_md5sum
(
tmp_path
,
md5sum
):
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
except
:
os
.
remove
(
tmp_path
)
raise
finally
:
os
.
close
(
handle
)
finally
:
os
.
close
(
handle
)
except
:
os
.
remove
(
tmp_path
)
raise
if
path
:
shutil
.
move
(
tmp_path
,
path
)
...
...
@@ -190,14 +193,25 @@ class Download(object):
if
self
.
hash_name
:
return
md5
(
url
).
hexdigest
()
else
:
parsed
=
urlparse
.
urlparse
(
url
)
if
re
.
match
(
r"^[A-Za-z]:\\"
,
url
):
url
=
'file:'
+
url
parsed
=
urlparse
.
urlparse
(
url
,
'file'
)
url_path
=
parsed
[
2
]
for
name
in
reversed
(
url_path
.
split
(
'/'
)):
if
name
:
return
name
if
parsed
[
0
]
==
'file'
:
while
True
:
url_path
,
name
=
os
.
path
.
split
(
url_path
)
if
name
:
return
name
if
not
url_path
:
break
else
:
url_host
,
url_port
=
parsed
[
-
2
:]
return
'%s:%s'
%
(
url_host
,
url_port
)
for
name
in
reversed
(
url_path
.
split
(
'/'
)):
if
name
:
return
name
url_host
,
url_port
=
parsed
[
-
2
:]
return
'%s:%s'
%
(
url_host
,
url_port
)
def
check_md5sum
(
path
,
md5sum
):
...
...
src/zc/buildout/download.txt
View file @
78c58c2b
...
...
@@ -121,7 +121,7 @@ scheme will still work:
>>> cat(download(join(server_data, 'foo.txt'))[0])
This is a foo text.
>>> cat(download('file:
//%s/foo.txt' % server_data
)[0])
>>> cat(download('file:
' + join(server_data, 'foo.txt')
)[0])
This is a foo text.
>>> remove(path)
...
...
@@ -231,7 +231,7 @@ sometimes used to create source distributions:
>>> write(server_data, 'foo.txt', 'This is a foo text.')
>>> download = Download(cache=cache)
>>> cat(download('file:
//
' + join(server_data, 'foo.txt'), path=path)[0])
>>> cat(download('file:' + join(server_data, 'foo.txt'), path=path)[0])
This is a foo text.
>>> ls(cache)
- foo.txt
...
...
@@ -260,7 +260,7 @@ as a directory in the file system yet:
>>> Download(cache=join(cache, 'non-existent'))(server_url+'foo.txt')
Traceback (most recent call last):
UserError: The directory:
'/
tmp/tmpZ2cwCfbuildoutSetUp/_TEST_/
download-cache/non-existent'
'/download-cache/non-existent'
to be used as a download cache doesn't exist.
Using namespace sub-directories of the download cache
...
...
@@ -337,7 +337,7 @@ checksum since we don't know which port the server happens to listen at when
the test is run, so we don't actually know the full URL of the file. Let's
check that the checksum actually belongs to the particular URL used:
>>> path
== join(cache, md5(server_url+'foo.txt').hexdigest()
)
>>> path
.lower() == join(cache, md5(server_url+'foo.txt').hexdigest()).lower(
)
True
The cached copy is used when downloading the file again:
...
...
@@ -359,7 +359,7 @@ cache under a different name:
/download-cache/537b6d73267f8f4447586989af8c470e
>>> path == path2
False
>>> path2
== join(cache, md5(server_url+'other/foo.txt').hexdigest()
)
>>> path2
.lower() == join(cache, md5(server_url+'other/foo.txt').hexdigest()).lower(
)
True
>>> cat(path)
This is a foo text.
...
...
src/zc/buildout/tests.py
View file @
78c58c2b
...
...
@@ -2818,7 +2818,7 @@ def test_suite():
tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
(re.compile('
0
x
[
0
-
9
a
-
f
]
+
'), '
<
MEM
ADDRESS
>
'),
(re.compile('
0
x
[
0
-
9
a
-
f
A
-
F
]
+
'), '
<
MEM
ADDRESS
>
'),
(re.compile('
http
:
//
localhost
:[
0
-
9
]{
4
,
5
}
/
'),
'
http
:
//
localhost
/
'),
(re.compile('
[
0
-
9
a
-
f
]{
32
}
'), '
<
MD5
CHECKSUM
>
'),
...
...
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