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
7
Merge Requests
7
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
slapos.buildout
Commits
20d302f2
Commit
20d302f2
authored
Dec 29, 2021
by
Julien Muchembled
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
download: stop using deprecated urlretrieve
parent
c9e9b267
Pipeline
#19077
passed with stage
in 0 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
src/zc/buildout/download.py
src/zc/buildout/download.py
+14
-6
No files found.
src/zc/buildout/download.py
View file @
20d302f2
...
...
@@ -20,7 +20,7 @@ except ImportError:
try
:
# Python 3
from
urllib.request
import
urlretrieve
from
urllib.request
import
build_opener
,
Request
from
urllib.parse
import
urlparse
except
ImportError
:
# Python 2
...
...
@@ -28,8 +28,9 @@ except ImportError:
from
urlparse
import
urlparse
from
urlparse
import
urlunparse
import
urllib2
from
urllib2
import
build_opener
def
urlretrieve
(
url
,
tmp_path
):
def
Request
(
url
):
"""Work around Python issue 24599 includig basic auth support
"""
scheme
,
netloc
,
path
,
params
,
query
,
frag
=
urlparse
(
url
)
...
...
@@ -42,10 +43,7 @@ except ImportError:
req
.
add_header
(
"Authorization"
,
basic
)
else
:
req
=
urllib2
.
Request
(
url
)
url_obj
=
urllib2
.
urlopen
(
req
)
with
open
(
tmp_path
,
'wb'
)
as
fp
:
fp
.
write
(
url_obj
.
read
())
return
tmp_path
,
url_obj
.
info
()
return
req
from
zc.buildout.easy_install
import
realpath
...
...
@@ -57,6 +55,16 @@ import shutil
import
tempfile
import
zc.buildout
_opener
=
None
def
urlretrieve
(
url
,
tmp_path
):
global
_opener
if
_opener
is
None
:
_opener
=
build_opener
()
url_obj
=
_opener
.
open
(
Request
(
url
))
with
open
(
tmp_path
,
'wb'
)
as
fp
:
shutil
.
copyfileobj
(
url_obj
,
fp
)
return
tmp_path
,
url_obj
.
info
()
class
ChecksumError
(
zc
.
buildout
.
UserError
):
pass
...
...
Julien Muchembled
@jm
mentioned in merge request
!25 (merged)
·
Dec 29, 2021
mentioned in merge request
!25 (merged)
mentioned in merge request !25
Toggle commit list
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