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
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):
...
@@ -1262,7 +1262,8 @@ def _open(base, filename, seen, dl_options, override):
if
filename
in
seen
:
if
filename
in
seen
:
if
is_temp
:
if
is_temp
:
os
.
unlink
(
path
)
fp
.
close
()
os
.
remove
(
path
)
raise
zc
.
buildout
.
UserError
(
"Recursive file include"
,
seen
,
filename
)
raise
zc
.
buildout
.
UserError
(
"Recursive file include"
,
seen
,
filename
)
root_config_file
=
not
seen
root_config_file
=
not
seen
...
@@ -1274,7 +1275,8 @@ def _open(base, filename, seen, dl_options, override):
...
@@ -1274,7 +1275,8 @@ def _open(base, filename, seen, dl_options, override):
parser
.
optionxform
=
lambda
s
:
s
parser
.
optionxform
=
lambda
s
:
s
parser
.
readfp
(
fp
)
parser
.
readfp
(
fp
)
if
is_temp
:
if
is_temp
:
os
.
unlink
(
path
)
fp
.
close
()
os
.
remove
(
path
)
extends
=
extended_by
=
None
extends
=
extended_by
=
None
for
section
in
parser
.
sections
():
for
section
in
parser
.
sections
():
...
...
src/zc/buildout/download.py
View file @
78c58c2b
...
@@ -21,6 +21,7 @@ from zc.buildout.easy_install import realpath
...
@@ -21,6 +21,7 @@ from zc.buildout.easy_install import realpath
import
logging
import
logging
import
os
import
os
import
os.path
import
os.path
import
re
import
shutil
import
shutil
import
tempfile
import
tempfile
import
urllib
import
urllib
...
@@ -148,6 +149,8 @@ class Download(object):
...
@@ -148,6 +149,8 @@ class Download(object):
returned and the client code is responsible for cleaning it up.
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'
)
parsed_url
=
urlparse
.
urlparse
(
url
,
'file'
)
url_scheme
,
_
,
url_path
=
parsed_url
[:
3
]
url_scheme
,
_
,
url_path
=
parsed_url
[:
3
]
if
url_scheme
==
'file'
:
if
url_scheme
==
'file'
:
...
@@ -171,11 +174,11 @@ class Download(object):
...
@@ -171,11 +174,11 @@ class Download(object):
if
not
check_md5sum
(
tmp_path
,
md5sum
):
if
not
check_md5sum
(
tmp_path
,
md5sum
):
raise
ChecksumError
(
raise
ChecksumError
(
'MD5 checksum mismatch downloading %r'
%
url
)
'MD5 checksum mismatch downloading %r'
%
url
)
except
:
finally
:
os
.
remove
(
tmp_path
)
os
.
close
(
handle
)
raise
except
:
finally
:
os
.
remove
(
tmp_path
)
os
.
close
(
handle
)
raise
if
path
:
if
path
:
shutil
.
move
(
tmp_path
,
path
)
shutil
.
move
(
tmp_path
,
path
)
...
@@ -190,14 +193,25 @@ class Download(object):
...
@@ -190,14 +193,25 @@ class Download(object):
if
self
.
hash_name
:
if
self
.
hash_name
:
return
md5
(
url
).
hexdigest
()
return
md5
(
url
).
hexdigest
()
else
:
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
]
url_path
=
parsed
[
2
]
for
name
in
reversed
(
url_path
.
split
(
'/'
)):
if
name
:
if
parsed
[
0
]
==
'file'
:
return
name
while
True
:
url_path
,
name
=
os
.
path
.
split
(
url_path
)
if
name
:
return
name
if
not
url_path
:
break
else
:
else
:
url_host
,
url_port
=
parsed
[
-
2
:]
for
name
in
reversed
(
url_path
.
split
(
'/'
)):
return
'%s:%s'
%
(
url_host
,
url_port
)
if
name
:
return
name
url_host
,
url_port
=
parsed
[
-
2
:]
return
'%s:%s'
%
(
url_host
,
url_port
)
def
check_md5sum
(
path
,
md5sum
):
def
check_md5sum
(
path
,
md5sum
):
...
...
src/zc/buildout/download.txt
View file @
78c58c2b
...
@@ -121,7 +121,7 @@ scheme will still work:
...
@@ -121,7 +121,7 @@ scheme will still work:
>>> cat(download(join(server_data, 'foo.txt'))[0])
>>> cat(download(join(server_data, 'foo.txt'))[0])
This is a foo text.
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.
This is a foo text.
>>> remove(path)
>>> remove(path)
...
@@ -231,7 +231,7 @@ sometimes used to create source distributions:
...
@@ -231,7 +231,7 @@ sometimes used to create source distributions:
>>> write(server_data, 'foo.txt', 'This is a foo text.')
>>> write(server_data, 'foo.txt', 'This is a foo text.')
>>> download = Download(cache=cache)
>>> 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.
This is a foo text.
>>> ls(cache)
>>> ls(cache)
- foo.txt
- foo.txt
...
@@ -260,7 +260,7 @@ as a directory in the file system yet:
...
@@ -260,7 +260,7 @@ as a directory in the file system yet:
>>> Download(cache=join(cache, 'non-existent'))(server_url+'foo.txt')
>>> Download(cache=join(cache, 'non-existent'))(server_url+'foo.txt')
Traceback (most recent call last):
Traceback (most recent call last):
UserError: The directory:
UserError: The directory:
'/
tmp/tmpZ2cwCfbuildoutSetUp/_TEST_/
download-cache/non-existent'
'/download-cache/non-existent'
to be used as a download cache doesn't exist.
to be used as a download cache doesn't exist.
Using namespace sub-directories of the download cache
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
...
@@ -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
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:
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
True
The cached copy is used when downloading the file again:
The cached copy is used when downloading the file again:
...
@@ -359,7 +359,7 @@ cache under a different name:
...
@@ -359,7 +359,7 @@ cache under a different name:
/download-cache/537b6d73267f8f4447586989af8c470e
/download-cache/537b6d73267f8f4447586989af8c470e
>>> path == path2
>>> path == path2
False
False
>>> path2
== join(cache, md5(server_url+'other/foo.txt').hexdigest()
)
>>> path2
.lower() == join(cache, md5(server_url+'other/foo.txt').hexdigest()).lower(
)
True
True
>>> cat(path)
>>> cat(path)
This is a foo text.
This is a foo text.
...
...
src/zc/buildout/tests.py
View file @
78c58c2b
...
@@ -2818,7 +2818,7 @@ def test_suite():
...
@@ -2818,7 +2818,7 @@ def test_suite():
tearDown=zc.buildout.testing.buildoutTearDown,
tearDown=zc.buildout.testing.buildoutTearDown,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS,
checker=renormalizing.RENormalizing([
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
}
/
'),
(re.compile('
http
:
//
localhost
:[
0
-
9
]{
4
,
5
}
/
'),
'
http
:
//
localhost
/
'),
'
http
:
//
localhost
/
'),
(re.compile('
[
0
-
9
a
-
f
]{
32
}
'), '
<
MD5
CHECKSUM
>
'),
(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